cjhutto / vaderSentiment

VADER Sentiment Analysis. VADER (Valence Aware Dictionary and sEntiment Reasoner) is a lexicon and rule-based sentiment analysis tool that is specifically attuned to sentiments expressed in social media, and works well on texts from other domains.
MIT License
4.39k stars 1k forks source link

Sentiment analysis using Vader #79

Closed jyayoub closed 4 years ago

jyayoub commented 5 years ago

I am running a sentiment analysis on amazon product reviews (1000 reviews). I noticed that when I run VADER sentiment analysis on all the reviews, I am obtaining different sentiment polarity and intensity as compared to running each review separate. An example is shown below. if I run all the reviews: "It is all but perfection." ------------------------------------- {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound': 0.0} "I also like the ease of operating the answering machine as well." {'neg': 0.0, 'neu': 0.667, 'pos': 0.333, 'compound': 0.6124} "I was resistant to buying an Amazon Fire because I thought my smart TV and cable box were doing a great job." {'neg': 0.089, 'neu': 0.595, 'pos': 0.316, 'compound': 0.7269} "it is really helpful for browsing and basic activities" -------- {'neg': 0.0, 'neu': 0.721, 'pos': 0.279, 'compound': 0.4754} "Parental control on this is great, both us as parents and my son love this device." {'neg': 0.0, 'neu': 0.628, 'pos': 0.372, 'compound': 0.8519} "I also love the fact that you added a memory slot." ------------ {'neg': 0.0, 'neu': 0.682, 'pos': 0.318, 'compound': 0.6369},...…………………………………....

If I run each review separately: It is all but perfection.---------------------------------------- {'neg': 0.0, 'neu': 0.442, 'pos': 0.558, 'compound': 0.7227} Any suggestions why this problem is happening?

cjhutto commented 4 years ago

I'm not able to reproduce this... maybe I'm not understanding your issue.

When I run:

from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer as sia

tricky_sentences = ["It is all but perfection.",
                    "I also like the ease of operating the answering machine as well.",
                    "I was resistant to buying an Amazon Fire because I thought my smart TV and cable box were doing a great job.",
                    "it is really helpful for browsing and basic activities",
                    "Parental control on this is great, both us as parents and my son love this device.",
                    "I also love the fact that you added a memory slot."
                    ]
vader = sia()
for sentence in tricky_sentences:
    vs = vader.polarity_scores(sentence)
    print("{:-<65} {}".format(sentence, str(vs)))

I get this result

It is all but perfection.
          ------------------ {'neg': 0.0, 'neu': 0.442, 'pos': 0.558, 'compound': 0.7227}
I also like the ease of operating the answering machine as well.
          ------------------ {'neg': 0.0, 'neu': 0.559, 'pos': 0.441, 'compound': 0.7269}
I was resistant to buying an Amazon Fire because I thought my smart TV and cable box were doing a great job. 
          ------------------ {'neg': 0.083, 'neu': 0.623, 'pos': 0.294, 'compound': 0.7269}
it is really helpful for browsing and basic activities
          ------------------ {'neg': 0.0, 'neu': 0.721, 'pos': 0.279, 'compound': 0.4754}
Parental control on this is great, both us as parents and my son love this device. 
          ------------------ {'neg': 0.0, 'neu': 0.628, 'pos': 0.372, 'compound': 0.8519}
I also love the fact that you added a memory slot.
          ------------------  {'neg': 0.0, 'neu': 0.704, 'pos': 0.296, 'compound': 0.6369}