How to generate sentiment treebank in Stanford NLP

977 views Asked by At

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

There are 1 answers

1
StanfordNLPHelp On BEST ANSWER

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 .)))