Stanford CoreNLP 中的详细情绪评分

Detailed Sentiment Score in Stanford CoreNLP

在 StanfordCore NLP 网站上有以下演示:http://nlp.stanford.edu:8080/sentiment/rntnDemo.html

该演示为一个句子提供了从 0 到 4 的详细情感分数。

我了解如何使用命令行进行 "positive" 或 "negative" 评估,类似于: Screenshot from corenlp.run showing a positive sentiment analysis

我已经看过这个问题,但我对如何创建所附屏幕截图中显示的分析感兴趣。 Getting sentiment analysis result using stanford core nlp java code

Stanford CoreNLP 是否有办法 return 给定句子的分数(即 0-4)以显示其积极或消极程度?

谢谢!

有多种方法可以获得此类信息。

另外我要注意有一个直接映射:

"Very negative" = 0 "Negative" = 1 "Neutral" = 2 "Positive" = 3 "Very positive" = 4

这是一个示例命令:

java -Xmx8g edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,parse,sentiment -file example-1.txt -outputFormat json

在文件 example-1.txt.json 中,您会看到该句子的许多与情感相关的字段,包括 sentimentValue

在这个 GitHub 问题上有更多关于此的信息:

https://github.com/stanfordnlp/CoreNLP/issues/465