1

As title states, code is as follows:

from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer

new_words = {
    '': 4.0,
}

sia = SentimentIntensityAnalyzer()
sia.lexicon.update(new_words)
sia.polarity_scores('')

The given emoji is considered to be negative by the original lexicon, but I want it to be positive instead. However, updating according to the above code does not seem to work at all:

{'neg': 1.0, 'neu': 0.0, 'pos': 0.0, 'compound': -0.34}

xrdty
  • 886
  • 2
  • 10
  • 22

1 Answers1

1

So apparently Vader transforms emojis to their word representation prior to extracting sentiment. You can find this mapping in "site-packages/vaderSentiment/emoji_utf8_lexicon.txt".

Updating the code to:

new_words = {
    'fire': 4.0,
}

works.

xrdty
  • 886
  • 2
  • 10
  • 22
  • It seems like my code is not working as expected. It is skipping all emojis. For example in the emoji lexicon is says "laughing with tears of joy" and using your solution did nt change the sentiment value at all. Is there some settings you have to allow for the emojis to be evaluated? – kristyna Oct 12 '22 at 18:34