【发布时间】:2018-11-21 15:22:56
【问题描述】:
我已经在 Eclipse 中设置了一个 Maven 项目。
它们是唯一的类,src/main/java/App.java 包 com.nlptools.corenlp;
import java.util.List;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.sentiment.SentimentPipeline;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
class App
{
public static void main( String[] args )
{
List<Annotation> list = SentimentPipeline.getAnnotations(new StanfordCoreNLP(), null, "foo.txt", false);
for (Annotation item : list) {
System.out.println(item.toString());
}
System.out.println( "Hello World!" );
}
}
然后我添加这些依赖并等待Gradle下载文件:
<dependency>
<groupId> edu.stanford.nlp </groupId>
<artifactId> stanford-corenlp </artifactId>
<version> 3.9.2</version>
</dependency>
<dependency>
<groupId> edu.stanford.nlp </groupId>
<artifactId> stanford-corenlp </artifactId>
<version> 3.9.2</version>
<classifier> models-english </classifier>
</dependency>
运行时出现此错误:
Couldn't read TokensRegexNER from edu/stanford/nlp/models/kbp/english/gazetteers/regexner_caseless.tab
我正在查看文档,但无法理解: https://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/sentiment/SentimentPipeline.html
我错过了什么?
【问题讨论】:
标签: java stanford-nlp