探索性数据分析SentiWordNet词典

时间:2019-01-05 12:59:44

标签: r sentiment-analysis

我使用sentiwordnet进行了情感分析。现在,我想获得有关如何获得这些结果的更多信息。

对于分析,我使用了sentimentr

sentiment = sentiment(Tweets$text_dict, 
                      polarity_dt = lexicon::hash_sentiment_sentiword, 
                      by = "tweet_id") 

结果如下:

head(sentiment)
   element_id sentence_id word_count  sentiment
1:          1           1          4  0.0000000
2:          2           1          8  0.2651650
3:          2           2          1 -0.5000000
4:          3           1          4 -0.0937500
5:          3           2          8 -0.1104854
6:          4           1         17  0.1788700

但是,我发现无法获得有关结果生成方式的信息,即每个类别中最常用的词。

对于tidytex t软件包,其中包含一些不错的功能。例如,我可以按类别打印最常用的单词及其情感值。

library(dplyr)
library(tidytext)


text_df <- Tweets %>%
  unnest_tokens(word, text_dict)

text_df %>%
  count(word, sort = TRUE)

bing_word_counts = text_df %>%
  inner_join(get_sentiments("bing")) %>%
  count(word, sentiment, sort = TRUE) %>%
  ungroup()


head(bing_word_counts)


  word    sentiment     n
  <chr>   <chr>     <int>
1 thank   positive    603
2 delayed negative    545
3 like    positive    430
4 great   positive    336
5 delay   negative    301
6 good    positive    298

是否可以使用sentiwordnet进行相同的分析?

0 个答案:

没有答案
相关问题