【问题标题】:Update qdap Dictionary for Sentiment Analysis更新用于情绪分析的 qdap 字典
【发布时间】:2018-04-27 06:50:10
【问题描述】:

我正在使用来自qdappolarity 函数。当组合起来说时,我想将几​​个词添加到字典中作为否定词。例如。

“很糟糕”

将其发送到极性函数时,极性分数变为中性。

> polarity("Pretty Bad")
  all total.sentences total.words ave.polarity sd.polarity stan.mean.polarity
1 all               1           2            0          NA                 NA

因为它认为漂亮是好词,坏词是坏词,因此聚合变为中性。

我想摆脱这个并想添加几个自定义词。

【问题讨论】:

  • 您可能想查看同一开发人员的sentimentr。在那里,您可以为其他单词创建新的哈希值。
  • qdap 中没有这样的选项吗? @phiver

标签: r nlp qdap


【解决方案1】:

要在字典中添加单词,请使用 Sentiment_frame 并制作您自己的词典。您可以根据需要添加更多单词。默认情况下,使用 key.pol 中的极化词。检查?极性

library(qdap)
polarity("pretty bad") 
# customised lexicon
positives = c("good","great")
negatives = c("bad","badly")
new_lexicon <- sentiment_frame(positives,negatives, pos.weights = 1, neg.weights = -1)  
counts(polarity("pretty bad",polarity.frame = new_lexicon))

【讨论】:

    猜你喜欢
    • 2011-05-10
    • 2013-02-22
    • 1970-01-01
    • 2011-08-29
    • 1970-01-01
    • 1970-01-01
    • 2013-02-02
    • 1970-01-01
    相关资源
    最近更新 更多