R 更新qdap情绪分析词典

R 更新qdap情绪分析词典,r,nlp,qdap,R,Nlp,Qdap,我正在使用qdap中的极性函数。当组合使用时,我想在字典中添加几个否定词。比如说 很糟糕 极性评分在发送至极性功能时变为中性 > polarity("Pretty Bad") all total.sentences total.words ave.polarity sd.polarity stan.mean.polarity 1 all 1 2 0 NA NA 因为

我正在使用qdap中的极性函数。当组合使用时,我想在字典中添加几个否定词。比如说

很糟糕

极性评分在发送至极性功能时变为中性

> polarity("Pretty Bad")
  all total.sentences total.words ave.polarity sd.polarity stan.mean.polarity
1 all               1           2            0          NA                 NA
因为它认为“漂亮”和“好”一样,而“坏”和“坏”一样,所以聚合变得中性


我想去掉这个,并想添加一些自定义单词。

要在字典中添加单词,请使用“情感”框架,并创建自己的字典。您可以根据需要添加更多单词。默认情况下,使用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))
你可能想看看同一个开发者的《感伤者》。在那里,您可以为其他单词创建新的哈希值。qdap中没有这样的选项吗@菲弗