【问题标题】:VaderSentiment: unable to update emoji sentiment scoreVaderSentiment:无法更新表情符号情绪分数
【发布时间】:2020-08-04 14:25:00
【问题描述】:

如标题所述,代码如下:

from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer

new_words = {
    '????': 4.0,
}

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

给定的表情符号被原始词典认为是负面的,但我希望它是正面的。但是按照上面的代码更新好像根本不起作用:

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

【问题讨论】:

    标签: python sentiment-analysis vader


    【解决方案1】:

    显然,Vader 在提取情感之前将表情符号转换为它们的单词表示。您可以在“site-packages/vaderSentiment/emoji_utf8_lexicon.txt”中找到此映射。

    将代码更新为:

    new_words = {
        'fire': 4.0,
    }
    

    有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-24
      • 2013-08-28
      • 2013-02-02
      • 1970-01-01
      相关资源
      最近更新 更多