【问题标题】:Sentiment analysis in R not recognizing modifying wordsR中的情感分析无法识别修饰词
【发布时间】:2018-05-16 19:10:44
【问题描述】:

我在使用 R 中的 SentimentAnalysis 时遇到问题。我想找到一种方法在 r 中进行情绪分析,而不仅仅是基于单个单词的正面或负面。例如

library(SentimentAnalysis) 
sentiment_pos <- analyzeSentiment("This presentation is excellent and Informative ")
convertToDirection(sentiment_pos$SentimentQDAP)
sentiment_neg <- analyzeSentiment("This presentation is not excellent")
convertToDirection(sentiment_neg$SentimentQDAP)

这个包给两个句子都打分(我认为是因为它是基于字典的,并且没有考虑到“not”是一个否定修饰符)。我正在尝试模仿 python 包 textblob 的功能,但使用 R。有人对具有此功能的包有任何想法吗?

【问题讨论】:

    标签: r nlp


    【解决方案1】:

    您可以使用sentimentr。给你的 2 个句子评分会给出不同的情感,因为情感者使用可以改变单词极性的价移器。

    library(sentimentr)
    
    sentiment("This presentation is excellent and Informative")
       element_id sentence_id word_count sentiment
    1:          1           1          6 0.4082483
    
    sentiment("This presentation is not excellent")
       element_id sentence_id word_count  sentiment
    1:          1           1          5 -0.4472136
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多