我正在使用Sentiment Stanford NLP库进行情绪分析。
现在我想从一句话中生成一个树库
输入句子:“有效但太不温不火的传记片”
输出树库:(2 (3 (3有效) (2但是)) (1 (1太温热) (2传记)
有谁能教我怎么做吗?谢谢大家。
发布于 2017-03-21 11:27:37
所以我不得不推送一个SentimentPipeline的bug修复。
如果您从GitHub获得最新代码并使用该版本:https://github.com/stanfordnlp/CoreNLP
您可以发出以下命令:
java -Xmx8g edu.stanford.nlp.sentiment.SentimentPipeline -file example-sentences.txt -output PENNTREES你会得到如下的输出:
I really liked the movie.
(3 (2 I) (3 (2 really) (3 (3 (3 liked) (2 (2 the) (2 movie))) (2 .))))
I hated the movie.
(1 (2 I) (1 (1 (1 hated) (2 (2 the) (2 movie))) (2 .)))https://stackoverflow.com/questions/42801238
复制相似问题