使用stanford core nlp java代码获得情绪分析结果 [英] Getting sentiment analysis result using stanford core nlp java code

查看:278
本文介绍了使用stanford core nlp java代码获得情绪分析结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们在斯坦福演示页面上测试时: http://nlp.stanford。 edu:8080 / sentiment / rntnDemo.html

When we test it on Stanford demo page: http://nlp.stanford.edu:8080/sentiment/rntnDemo.html

它为树提供每个节点的情绪分数如下:

it gives the tree with the sentiment score of each node as below:

我正在尝试使用命令在我的本地系统上测试它:

I am trying to test it on my local system using command:

H:\Drive E\Stanford\stanfor-corenlp-full-2013~>java -cp "*" edu.stanford.nlp.sen
timent.Evaluate edu/stanford/nlp/models/sentiment/sentiment.ser.gz test.txt

text.txt

这部电影并不关心聪明,机智或任何其他智能幽默。
那些在美丽的事物中找到丑陋意义的人是腐败而不迷人。

产生结果:

任何人都可以告诉我为什么它为空?或许我在执行中犯了什么错误?我的目的是分析文本并用分数得到情绪结果。

Can anyone please tell me why it is null? Or maybe I'm making any mistake in execution? My purpose is to analyze the text and get the sentiment result with the score.

推荐答案

您使用的文件是错误的命令不完整。下面是你应该使用的命令。

The file you are using is wrong and also the command is incomplete. Below is the command you should be using.

java -cp*edu.stanford.nlp.sentiment.Evaluate -model edu / stanford / nlp / models / sentiment /sentiment.ser.gz-treebank test.txt

java -cp "*" edu.stanford.nlp.sentiment.Evaluate -model edu/stanford/nlp/models/sentiment/sentiment.ser.gz -treebank test.txt

和text.txt文件不包含普通句子,而是包含treebank

and text.txt file does not contain plain sentence, rather it contains treebank

例如

(2 (3 (3 Effective) (2 but)) (1 (1 too-tepid) (2 biopic)))
(3 (3 (2 If) (3 (2 you) (3 (2 sometimes) (2 (2 like) (3 (2 to) (3 (3 (2 go) (2 (2 to) (2 (2 the) (2 movies)))) (3 (2 to) (3 (2 have) (4 fun))))))))) (2 (2 ,) (2 (2 Wasabi) (3 (3 (2 is) (2 (2 a) (2 (3 good) (2 (2 place) (2 (2 to) (2 start)))))) (2 .)))))
(4 (4 (4 (3 (2 Emerges) (3 (2 as) (3 (2 something) (3 rare)))) (2 ,)) (4 (2 (2 an) (2 (2 issue) (2 movie))) (3 (2 that) (3 (3 (2 's) (4 (3 (3 (2 so) (4 honest)) (2 and)) (3 (2 keenly) (2 observed)))) (2 (2 that) (2 (2 it) (2 (1 (2 does) (2 n't)) (2 (2 feel) (2 (2 like) (2 one)))))))))) (2 .))
(2 (2 (2 The) (2 film)) (3 (3 (3 (3 provides) (2 (2 some) (3 (4 great) (2 insight)))) (3 (2 into) (3 (2 (2 the) (2 (2 neurotic) (2 mindset))) (3 (2 of) (2 (2 (2 (2 (2 all) (2 comics)) (2 --)) (2 even)) (3 (2 those) (4 (2 who) (4 (2 have) (4 (2 reached) (4 (4 (2 the) (3 (2 absolute) (2 top))) (2 (2 of) (2 (2 the) (2 game))))))))))))) (2 .)))

收到的输出是

EVALUATION SUMMARY
Tested 82600 labels
  66258 correct
  16342 incorrect
  0.802155 accuracy
Tested 2210 roots
  976 correct
  1234 incorrect
  0.441629 accuracy
Label confusion matrix: rows are gold label, columns predicted label
       323      1294       292        99         0
       161      5498      2993       602         1
        27      2245     51972      2283        21
         3       652      2868      7247       228
         3       148       282      2140      1218
Root label confusion matrix: rows are gold label, columns predicted label
        44       193        23        19         0
        39       451        62        81         0
         9       190        82       101         7
         0       131        30       299        50
         0        36         8       255       100
Approximate Negative label accuracy: 0.912008
Approximate Positive label accuracy: 0.930750
Combined approximate label accuracy: 0.923128
Approximate Negative root label accuracy: 0.879081
Approximate Positive root label accuracy: 0.808266
Combined approximate root label accuracy: 0.842756

希望这会有所帮助:) !!

Hope this helps :) !!

这篇关于使用stanford core nlp java代码获得情绪分析结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆