当前位置: 首页 > news >正文

wordpress下载验证码站长工具seo综合查询外部链接数量

wordpress下载验证码,站长工具seo综合查询外部链接数量,创意设计报告模板,个人公众号做电影网站吗图片来源#xff1a;网络编译Hope、臻臻、CoolBoy文章来源大数据文摘出品如有转载#xff0c;请联系原作者。最近#xff0c;租房这事儿成了北漂族的一大bug#xff0c;要想租到称心如意的房子#xff0c;不仅要眼明手快#xff0c;还得看清各类“前辈”的评价避开大坑。… 图片来源网络编译Hope、臻臻、CoolBoy文章来源大数据文摘出品如有转载请联系原作者。最近租房这事儿成了北漂族的一大bug要想租到称心如意的房子不仅要眼明手快还得看清各类“前辈”的评价避开大坑。一位程序员在出行选酒店的时候就借用了程序工具先用python爬下了海外点评网站TripAdvisor的数千评论并且用R进行了文本分析和情感分析科学选房高效便捷极具参考价值。以下这份超详实的教程拿好不谢。TripAdvisor提供的信息对于旅行者的出行决策非常重要。但是要去了解TripAdvisor的泡沫评分和数千个评论文本之间的细微差别是极具挑战性的。为了更加全面地了解酒店旅客的评论是否会对之后酒店的服务产生影响我爬取了TripAdvisor中一个名为Hilton Hawaiian Village酒店的所有英文评论。这里我不会对爬虫的细节进行展开。Python源码https://github.com/susanli2016/NLP-with-Python/blob/master/Web%20scraping%20Hilton%20Hawaiian%20Village%20TripAdvisor%20Reviews.py加载扩展包library(dplyr)library(readr)library(lubridate)library(ggplot2)library(tidytext)library(tidyverse)library(stringr)library(tidyr)library(scales)library(broom)library(purrr)library(widyr)library(igraph)library(ggraph)library(SnowballC)library(wordcloud)library(reshape2)theme_set(theme_minimal())数据集df - read_csv(Hilton_Hawaiian_Village_Waikiki_Beach_Resort-Honolulu_Oahu_Hawaii__en.csv)df - df[complete.cases(df), ]df$review_date - as.Date(df$review_date, format %d-%B-%y)dim(df); min(df$review_date); max(df$review_date)Figure 2我们在TripAdvisor上一共获得了13,701条关于Hilton Hawaiian Village酒店的英文评论这些评论的时间范围是从2002–03–21 到2018–08–02。df %%  count(Week round_date(review_date, week)) %%  ggplot(aes(Week, n))  geom_line()  ggtitle(The Number of Reviews Per Week)Figure 2在2014年末周评论数量达到最高峰。那一个星期里酒店被评论了70次。对评论文本进行文本挖掘df - tibble::rowid_to_column(df, ID)df - df %%  mutate(review_date as.POSIXct(review_date, origin 1970-01-01),month round_date(review_date, month))review_words - df %%  distinct(review_body, .keep_all TRUE) %%  unnest_tokens(word, review_body, drop FALSE) %%  distinct(ID, word, .keep_all TRUE) %%  anti_join(stop_words, by word) %%  filter(str_detect(word, [^\\d])) %%  group_by(word) %%  mutate(word_total n()) %%  ungroup()word_counts - review_words %%  count(word, sort TRUE)word_counts %%  head(25) %%  mutate(word reorder(word, n)) %%  ggplot(aes(word, n))  geom_col(fill lightblue)  scale_y_continuous(labels comma_format())  coord_flip()  labs(title Most common words in review text 2002 to date,       subtitle Among 13,701 reviews; stop words removed,       y # of uses)Figure 3我们还可以更进一步的把“stay”和“stayed”“pool”和“pools”这些意思相近的词合并起来。这个步骤被称为词干提取也就是将变形或是衍生词语缩减为词干基词或根词的过程。word_counts %%  head(25) %%  mutate(word wordStem(word)) %%  mutate(word reorder(word, n)) %%  ggplot(aes(word, n))  geom_col(fill lightblue)  scale_y_continuous(labels comma_format())  coord_flip()  labs(title Most common words in review text 2002 to date,       subtitle Among 13,701 reviews; stop words removed and stemmed,       y # of uses)Figure 4二元词组通常我们希望了解评论中单词的相互关系。哪些词组在评论文本中比较常用呢如果给出一列单词那么后面会随之出现什么单词呢哪些词之间的关联性最强许多有意思的文本挖掘都是基于这些关系的。在研究两个连续单词的时候我们称这些单词对为“二元词组”。所以在Hilton Hawaiian Village的评论中哪些是最常见的二元词组呢review_bigrams - df %%  unnest_tokens(bigram, review_body, token ngrams, n 2)bigrams_separated - review_bigrams %%  separate(bigram, c(word1, word2), sep )bigrams_filtered - bigrams_separated %%  filter(!word1 %in% stop_words$word) %%  filter(!word2 %in% stop_words$word)bigram_counts - bigrams_filtered %%  count(word1, word2, sort TRUE)bigrams_united - bigrams_filtered %%  unite(bigram, word1, word2, sep )bigrams_united %%  count(bigram, sort TRUE)Figure 5最常见的二元词组是“rainbow tower”彩虹塔其次是“hawaiian village”夏威夷村。我们可以利用网络可视化来展示这些二元词组review_subject - df %%  unnest_tokens(word, review_body) %%  anti_join(stop_words)my_stopwords - data_frame(word c(as.character(1:10)))review_subject - review_subject %%  anti_join(my_stopwords)title_word_pairs - review_subject %%  pairwise_count(word, ID, sort TRUE, upper FALSE)set.seed(1234)title_word_pairs %%  filter(n 1000) %%  graph_from_data_frame() %%  ggraph(layout fr)  geom_edge_link(aes(edge_alpha n, edge_width n), edge_colour cyan4)  geom_node_point(size 5)  geom_node_text(aes(label name), repel TRUE,                 point.padding unit(0.2, lines))  ggtitle(Word network in TripAdvisor reviews)  theme_void()Figure 6上图展示了TripAdvisor评论中较为常见的二元词组。这些词至少出现了1000次而且其中不包含停用词。在网络图中我们发现出现频率最高的几个词存在很强的相关性“hawaiian”, “village”, “ocean” 和“view”不过我们没有发现明显的聚集现象。三元词组二元词组有时候还不足以说明情况让我们来看看TripAdvisor中关于Hilton Hawaiian Village酒店最常见的三元词组有哪些。review_trigrams - df %%  unnest_tokens(trigram, review_body, token ngrams, n 3)trigrams_separated - review_trigrams %%  separate(trigram, c(word1, word2, word3), sep )trigrams_filtered - trigrams_separated %%  filter(!word1 %in% stop_words$word) %%  filter(!word2 %in% stop_words$word) %%  filter(!word3 %in% stop_words$word)trigram_counts - trigrams_filtered %%  count(word1, word2, word3, sort TRUE)trigrams_united - trigrams_filtered %%  unite(trigram, word1, word2, word3, sep )trigrams_united %%  count(trigram, sort TRUE)Figure 7最常见的三元词组是“hilton hawaiian village”其次是“diamond head tower”等等。评论中关键单词的趋势随着时间的推移哪些单词或话题变得更加常见或者更加罕见了呢从这些信息我们可以探知酒店做出的调整比如在服务上翻新上解决问题上。我们还可以预测哪些主题会更多地被提及。我们想要解决类似这样的问题随着时间的推移在TripAdvisor的评论区中哪些词出现的频率越来越高了reviews_per_month - df %%  group_by(month) %%  summarize(month_total n())word_month_counts - review_words %%  filter(word_total 1000) %%  count(word, month) %%  complete(word, month, fill list(n 0)) %%  inner_join(reviews_per_month, by month) %%  mutate(percent n / month_total) %%  mutate(year year(month) yday(month) / 365)mod - ~ glm(cbind(n, month_total - n) ~ year, ., family binomial)slopes - word_month_counts %%  nest(-word) %%  mutate(model map(data, mod)) %%  unnest(map(model, tidy)) %%  filter(term year) %%  arrange(desc(estimate))slopes %%  head(9) %%  inner_join(word_month_counts, by word) %%  mutate(word reorder(word, -estimate)) %%  ggplot(aes(month, n / month_total, color word))  geom_line(show.legend FALSE)  scale_y_continuous(labels percent_format())  facet_wrap(~ word, scales free_y)  expand_limits(y 0)  labs(x Year,       y Percentage of reviews containing this word,       title 9 fastest growing words in TripAdvisor reviews,       subtitle Judged by growth rate over 15 years)Figure 8在2010年以前我们可以看到大家讨论的焦点是“friday fireworks”周五的烟花和“lagoon”环礁湖。而在2005年以前“resort fee”度假费和“busy”繁忙这些词的词频增长最快。评论区中哪些词的词频在下降呢slopes %%  tail(9) %%  inner_join(word_month_counts, by word) %%  mutate(word reorder(word, estimate)) %%  ggplot(aes(month, n / month_total, color word))  geom_line(show.legend FALSE)  scale_y_continuous(labels percent_format())  facet_wrap(~ word, scales free_y)  expand_limits(y 0)  labs(x Year,       y Percentage of reviews containing this term,       title 9 fastest shrinking words in TripAdvisor reviews,       subtitle Judged by growth rate over 4 years)Figure 9这张图展示了自2010年以来逐渐变少的主题。这些词包括“hhv” (我认为这是 hilton hawaiian village的简称), “breakfast”早餐, “upgraded”升级 “prices”价格 and “free”免费。让我们对一些单词进行比较。word_month_counts %%  filter(word %in% c(service, food)) %%  ggplot(aes(month, n / month_total, color word))  geom_line(size 1, alpha .8)  scale_y_continuous(labels percent_format())  expand_limits(y 0)  labs(x Year,       y Percentage of reviews containing this term, title service vs food in terms of reviewers interest)Figure 10在2010年之前服务service和食物food都是热点主题。关于服务和食物的讨论在2003年到达顶峰自2005年之后就一直在下降只是偶尔会反弹。情感分析情感分析被广泛应用于对评论、调查、网络和社交媒体文本的分析以反映客户的感受涉及范围包括市场营销、客户服务和临床医学等。在本案例中我们的目标是对评论者也就是酒店旅客在住店之后对酒店的态度进行分析。这个态度可能是一个判断或是评价。下面来看评论中出现得最频繁的积极词汇和消极词汇。reviews - df %%  filter(!is.na(review_body)) %%  select(ID, review_body) %%  group_by(row_number()) %%  ungroup()tidy_reviews - reviews %%  unnest_tokens(word, review_body)tidy_reviews - tidy_reviews %%  anti_join(stop_words)bing_word_counts - tidy_reviews %%  inner_join(get_sentiments(bing)) %%  count(word, sentiment, sort TRUE) %%  ungroup()bing_word_counts %%  group_by(sentiment) %%  top_n(10) %%  ungroup() %%  mutate(word reorder(word, n)) %%  ggplot(aes(word, n, fill sentiment))  geom_col(show.legend FALSE)  facet_wrap(~sentiment, scales free)  labs(y Contribution to sentiment, x NULL)  coord_flip()  ggtitle(Words that contribute to positive and negative sentiment in the reviews)Figure 11让我们换一个情感文本库看看结果是否一样。contributions - tidy_reviews %%  inner_join(get_sentiments(afinn), by word) %%  group_by(word) %%  summarize(occurences n(),            contribution sum(score))contributions %%  top_n(25, abs(contribution)) %%  mutate(word reorder(word, contribution)) %%  ggplot(aes(word, contribution, fill contribution 0))  ggtitle(Words with the greatest contributions to positive/negative          sentiment in reviews)  geom_col(show.legend FALSE)  coord_flip()Figure 12有意思的是“diamond”出自“diamond head-钻石头”被归类为积极情绪。这里其实有一个潜在问题比如“clean”干净是什么词性取决于语境。如果前面有个“not”不这就是一个消极情感了。事实上一元词在否定词如not存在的时候经常碰到这种问题这就引出了我们下一个话题在情感分析中使用二元词组来辨明语境我们想知道哪些词经常前面跟着“not”不bigrams_separated %%  filter(word1 not) %%  count(word1, word2, sort TRUE)Figure 13“a”前面跟着“not”的情况出现了850次而“the”前面跟着“not”出现了698次。不过这种结果不是特别有实际意义。AFINN - get_sentiments(afinn)not_words - bigrams_separated %%  filter(word1 not) %%  inner_join(AFINN, by c(word2 word)) %%  count(word2, score, sort TRUE) %%  ungroup()not_wordsFigure 14上面的分析告诉我们在“not”后面最常见的情感词汇是“worth”其次是“recommend”这些词都被认为是积极词汇而且积极程度得分为2。所以在我们的数据中哪些单词最容易被误解为相反的情感not_words %%  mutate(contribution n * score) %%  arrange(desc(abs(contribution))) %%  head(20) %%  mutate(word2 reorder(word2, contribution)) %%  ggplot(aes(word2, n * score, fill n * score 0))  geom_col(show.legend FALSE)  xlab(Words preceded by \not\)  ylab(Sentiment score * number of occurrences)  ggtitle(The 20 words preceded by not that had the greatest contribution to          sentiment scores, positive or negative direction)  coord_flip()Figure 15二元词组“not worth”, “not great”, “not good”, “not recommend”和“not like”是导致错误判断的最大根源使得评论看起来比原来积极的多。除了“not”以外还有其他的否定词会对后面的内容进行情绪的扭转比如“no”, “never” 和“without”。让我们来看一下具体情况。negation_words - c(not, no, never, without)negated_words - bigrams_separated %%  filter(word1 %in% negation_words) %%  inner_join(AFINN, by c(word2 word)) %%  count(word1, word2, score, sort TRUE) %%  ungroup()negated_words %%  mutate(contribution n * score,         word2 reorder(paste(word2, word1, sep __), contribution)) %%  group_by(word1) %%  top_n(12, abs(contribution)) %%  ggplot(aes(word2, contribution, fill n * score 0))  geom_col(show.legend FALSE)  facet_wrap(~ word1, scales free)  scale_x_discrete(labels function(x) gsub(__.$, , x))  xlab(Words preceded by negation term)  ylab(Sentiment score * # of occurrences)  ggtitle(The most common positive or negative words to follow negations          such as no, not, never and without)  coord_flip()Figure 16看来导致错判为积极词汇的最大根源来自于“not worth/great/good/recommend”而另一方面错判为消极词汇的最大根源是“not bad” 和“no problem”。最后让我们来观察一下最积极和最消极的评论。sentiment_messages - tidy_reviews %%  inner_join(get_sentiments(afinn), by word) %%  group_by(ID) %%  summarize(sentiment mean(score),            words n()) %%  ungroup() %%  filter(words 5)sentiment_messages %%  arrange(desc(sentiment))Figure 17最积极的评论来自于ID为2363的记录“哇哇哇这地方太好了从房间我们可以看到很漂亮的景色我们住得很开心。Hilton酒店就是很棒无论是小孩还是大人这家酒店有着所有你想要的东西。”df[ which(df$ID2363), ]$review_body[1]Figure 18sentiment_messages %%  arrange(sentiment)Figure 19最消极的评论来自于ID为3748的记录“我住了5晚16年5月12日-5月17日。第一晚我们发现地砖坏了小孩子在玩手指。第二晚我们看到小蟑螂在儿童食物上爬。前台给我们换了房间但他们让我们一小时之内搬好房间否则就不能换房。。。已经晚上11点我们都很累了孩子们也睡了。我们拒绝了这个建议。退房的时候前台小姐跟我讲蟑螂在他们的旅馆里很常见。她还反问我在加州见不到蟑螂吗我没想到能在Hilton遇到这样的事情。”df[ which(df$ID3748), ]$review_body[1]Figure 20Github源码https://github.com/susanli2016/Data-Analysis-with-R/blob/master/Text%20Mining%20Hilton%20Hawaiian%20Village%20TripAdvisor%20Reviews.Rmd相关报道https://towardsdatascience.com/scraping-tripadvisor-text-mining-and-sentiment-analysis-for-hotel-reviews-cc4e20aef333完投稿啦精彩继续CSDN作为国内专业的云计算服务平台目前提供云计算、大数据、虚拟化、数据中心、OpenStack、CloudStack、机器学习、智能算法等相关云计算观点、技术、平台、实践、云产业咨询等服务。CSDN 公众号也一直坚持「与千万技术人共成长」的理念深度解读行业内热门技术与场景应用致力于让所有开发者保持敏锐的技术嗅觉、对行业趋势与技术获得更广阔的认知。文章题材首先你需要关注我们的公众号“CSDN云计算”这样你会更准确了解我们需要的文章风格侧重于云计算领域相关的文章可以是技术、运维、趋势等方面的务实内容原创要求文章有鲜明观点和看法。投稿须知 稿费根据原创性、实用性和时效性等方面进行审核通过的文章会发布在本微信平台。一经采用我们将支付作者酬劳。酬劳可能不多这代表的是一个心意更多是因为爱好是有识之士抒发胸怀的一种方式字数要求稿件字数以2K-8K为宜少于2K或多于8K都会一定程度降低阅读愉悦感投稿邮箱lijycsdn.net。或者添加微信表明来意微信号tangguoyemeng。请备注投稿姓名公司职位。如果咱们的合作稳定又愉快还可以签订合同长期合作哦
http://www.pierceye.com/news/433113/

相关文章:

  • 商洛建设网站有了网站源码可以做网站吗
  • 网站运营学习电子商务网站建设与管理的实验报告
  • 上海设计网站与太原免费网络推广哪里朿
  • 网站前端建设需要学会什么珠海网站优化公司
  • 北京微网站wordpress添加代码运行
  • 浙江省住房和城乡建设厅网站网站开发流程博客
  • 网站刷流量会怎么样广东网站备案时间
  • 昆明企业建站模板如何做网站品类
  • 学做网站去哪学网站开发app开发
  • 如何编写网站建设销售的心得网页设计制作方法
  • seo工具网站课程网站建设的步骤
  • 商务网站的类型一共有几大类小程序搜索排名帝搜sem880官网
  • 做海报的高清模板的网站诛仙3官方网站做花灯答案
  • 好用的网站后台管理系统黑龙江最新通知今天
  • 做招聘网站需要多少钱als冰桶挑战赛的网络营销方式
  • wordpress单位内网做网站云南省文山州网站建设
  • 单页网站制作视频教程四川餐饮培训学校排名
  • 微信公众平台网站建设wordpress中英切换
  • 万网x3主机l系统放两个网站自学设计的网站
  • 网站微信建设运维经验分享图营销app
  • 西安网站开发软件常州注册公司
  • 和网站建设相关的行业企业网络规划设计方案
  • 风中有朵雨做的云网站观看开网店教程
  • 网站建设与管理教学视频教程服务器绑定网站打不开
  • 百度云建站WordPress开发新客户的十大渠道
  • 南宁比优建站视屏网站的审核是怎么做的
  • 怎样建设尧都水果网站免费手机网站建站系统
  • 全网营销提供seo服务
  • 吕梁网站设计服务器网站建设维护合同
  • 网站轮播图片怎么做高校网站建设模板