How to edit NLTKs VADER sentiment lexicon without modifying a txt file
问题 I know you can add your own words by manually adding them to the vader_lexicon.txt file. I was wondering if there was another way that you can do it in the python code as I don't want people who use my code need to then go modify other .txt files. from nltk.sentiment.vader import SentimentIntensityAnalyzer as SIA sia = SIA() sia.lexicon This will get the dict. Was thinking something like: sia.lexicon.update{u'word': 3} 回答1: For anyone else: from nltk.sentiment.vader import