On the StanfordCore NLP website there is the following demo: http://nlp.stanford.edu:8080/sentiment/rntnDemo.html
The demo gives a sentence a detailed sentiment score from 0 to 4.
I understand how to get a "positive" or "negative" assessment using command line, similar to this: Screenshot from corenlp.run showing a positive sentiment analysis
I have seen this question already, but I am interested how the analysis shown in the attached screenshot is created. Getting sentiment analysis result using stanford core nlp java code
Is there a way in Stanford CoreNLP to return a score (ie 0-4) for a given sentence so show its degree of positivity or negativity?
Thanks!
There are multiple ways to get that kind of info.
Also I should note that the there is a direct mapping:
"Very negative" = 0 "Negative" = 1 "Neutral" = 2 "Positive" = 3 "Very positive" = 4
Here is a sample command:
java -Xmx8g edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,parse,sentiment -file example-1.txt -outputFormat json
In the file example-1.txt.json
you'll see a lot of sentiment related fields for the sentence, including sentimentValue
.
There is more info about this at this GitHub issue:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.