我正在使用来自polarity的qdap函数。有几个词,我想添加到字典中作为否定词说时,以组合。例如。
“漂亮坏”
当极性被发送到极性函数时,极性分数变得中性。
> polarity("Pretty Bad")
all total.sentences total.words ave.polarity sd.polarity stan.mean.polarity
1 all 1 2 0 NA NA因为它认为漂亮的词和坏的词一样好,所以集合就变成中性的。
我想摆脱这个,并想添加几个自定义词。
发布于 2019-08-21 10:42:38
若要在字典中添加单词,请使用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))https://stackoverflow.com/questions/50056847
复制相似问题