例如,我有一行文本“我很感激帮助”,我想从情感词典中删除“感激”这个词,这样它就不会影响任何情感得分。
问问题
25 次
1 回答
0
您可以创建自己的情绪表。从头开始或使用默认设置。
例子:
library(sentimentr)
txt <- "i appreciate the help"
sentiment(txt)
element_id sentence_id word_count sentiment
1: 1 1 4 0.25
调整情绪表。由于情绪表存储为 data.tables,因此首先加载 data.table。
library(data.table)
# remove word we do not want from default sentiment table coming from lexicon package
my_sent_table <- lexicon::hash_sentiment_jockers_rinker[x != "appreciate"]
sentiment(txt, polarity_dt = my_sent_table)
element_id sentence_id word_count sentiment
1: 1 1 4 0
于 2020-01-30T15:49:06.357 回答