pythonsentiment-analysistextblob

How to update the sentiment scores for some words in textblob?


I want to change the lexicon for Textblob by adding several new words with scores, and by slightly adjusting the score of the words that are already there. What is the best way to approach this?

In Vader sentiment it's done like this:

 SIA.lexicon.update(new_words)

Is there a similar command for Textblob?


Solution

  • Found the solution. The scores are stored in en-sentiment.xml file in .../site-packages/textblob/en.

    Words can be added to the file with corresponding scores or removed/updated.

    I'm not sure how to make both the original file and the updated one work together (i.e. how to choose which one I want), so I backed up the original file, and renamed the updated one to 'en-sentiment.xml'.