How to generate sentiment treebank in Stanford NLP

 ̄綄美尐妖づ 提交于 2019-12-12 04:23:02

问题


I'm using Sentiment Stanford NLP library for sentiment analytics.

Now I want to generate a treebank from a sentence

input sentence: "Effective but too-tepid biopic"

output tree bank: (2 (3 (3 Effective) (2 but)) (1 (1 too-tepid) (2 biopic)))

Can anybody show me how to do it ? Thank all.


回答1:


So I had to push a bug fix for the SentimentPipeline.

If you get the latest code from GitHub and use that version: https://github.com/stanfordnlp/CoreNLP

you can issue this command:

java -Xmx8g edu.stanford.nlp.sentiment.SentimentPipeline -file example-sentences.txt -output PENNTREES

and you'll get output like this:

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/how-to-generate-sentiment-treebank-in-stanford-nlp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!