【问题标题】:How to generate sentiment treebank in Stanford NLP如何在斯坦福 NLP 中生成情感树库
【发布时间】:2017-03-15 04:42:47
【问题描述】:
我正在使用 Sentiment Stanford NLP 库进行情绪分析。
现在我想从一个句子生成一个树库
输入句子:“Effective but too-tepid biopic”
输出树库:(2 (3 (3 Effective) (2 but)) (1 (1 too-tepid) (2 biopic)))
谁能告诉我怎么做?
谢谢大家。
【问题讨论】:
标签:
stanford-nlp
sentiment-analysis
penn-treebank
【解决方案1】:
所以我不得不为 SentimentPipeline 推送一个错误修复。
如果您从 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 .)))