1

I try sentiment analysis of tweet text by both stanford nlp python package and the live demo, but the results are different. The result of the python package is positive while the result of the live demo is negative.

  • For python package, I download stanford-corenlp-4.0.0 and install py-corenlp, basically follow the instruction in this answer: Stanford nlp for python, the code is shown below:
import pycorenlp
from pycorenlp import StanfordCoreNLP

nlp = StanfordCoreNLP("http://localhost:9000")
text="noted former cocaine user carrie fisher says donald trump was absolutely on coke makes sense"
res = nlp.annotate(text,properties={'annotators': 'sentiment','outputFormat': 'json','timeout': 1000})
for s in res["sentences"]:
    print(s["sentimentValue"], s["sentiment"])

and the result is:

3 Positive
  • For the live demo:

screenshot of the live demo result

Ruowei Liu
  • 13
  • 3
  • Why should you expect *either* a positive or a negative one for this utterance? This is just another demonstration that you can't rely on the analysis of individual utterances; sentiment analysis in its current form is inherently imprecise, but can be useful when you have a large enough collection of utterances on a topic that the extracted signal from the collection is stronger than the noise. – tripleee Jul 26 '20 at 06:48

1 Answers1

1

The old sentiment demo is probably running older code/older models, so that is why the results would be different. CoreNLP 4.0.0 should return POSITIVE for the entire sentence.

StanfordNLPHelp
  • 8,699
  • 1
  • 11
  • 9
  • Thanks for your reply. But I actually think the sentiment of the sentence should be Negative based on my judgment. Anyway, I will go with the python package. – Ruowei Liu Jul 26 '20 at 08:23