0

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

“很糟糕”

当将其发送到极性功能时,极性分数变为中性。

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

因为它认为好词是好词,坏词是坏词,因此聚合成为中性。

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

4

1 回答 1

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))
于 2019-08-21T10:42:38.583 回答