有没有办法用带注释的句子来更新 VADER:
new_sentences = {
'She has written more than 100 books.': '2',
}
这不起作用:
analyzer.lexicon.update(new_sentences)
有没有办法用带注释的句子来更新 VADER:
new_sentences = {
'She has written more than 100 books.': '2',
}
这不起作用:
analyzer.lexicon.update(new_sentences)
不幸的是,更新词典只能使用令牌来完成。您可以通过打印出来或在这里查看预定义的词典:https ://github.com/cjhutto/vaderSentiment/blob/master/vaderSentiment/vader_lexicon.txt
import nltk
nltk.download('vader_lexicon')
from nltk.sentiment.vader import SentimentIntensityAnalyzer
new_values = {"flaws": -3.0, "stain": -3.2, "complain": -2.0, "jazz": 4}
analyzer.lexicon.update(new_values)
analyzer = SentimentIntensityAnalyzer()
print(analyzer.lexicon)