斯坦福 NLP 情绪 运行 错误

Stanford NLP sentiment running error

我在 http://nlp.stanford.edu/software/stanford-corenlp-full-2015-04-20.zip

下载了 Stanford NLP 3.5.2

然后我解压缩文件并移动到新的解压缩目录。

我 运行 按照指示:

http://nlp.stanford.edu/sentiment/code.html

java edu.stanford.nlp.sentiment.Evaluate edu/stanford/nlp/models/sentiment/sentiment.ser.gz test.txt

然后我有一个错误:

"Error: Could not find or load main class edu.stanford.nlp.sentiment.Evaluate"

按照Whosebug中的一些说明,我使用了:

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

那我还有一个问题:

Exception in thread "main" java.lang.NullPointerException
    at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:461)
    at edu.stanford.nlp.io.IOUtils.readObjectFromURLOrClasspathOrFileSystem(IOUtils.java:313)
    at edu.stanford.nlp.sentiment.SentimentModel.loadSerialized(SentimentModel.java:627)
    at edu.stanford.nlp.sentiment.Evaluate.main(Evaluate.java:72)

我该如何解决这个问题? (我在 Mac 上使用 Java 8 1.8.0_25)

documentation is not up to date. The javadoc说你要在对应的文件前加上-model-treebank

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