stanford corenlp:加载标记器模型时出现不可恢复的错误
stanford corenlp: Unrecoverable error while loading a tagger model
我需要使用 Java API 的 StanfordTruecaser。我有这个代码:
String text = "i love paris. i am with barack obama";
//define the properties of the pipeline to be run and add annotators to it
Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, truecase");
pipeline = new StanfordCoreNLP(props);
//run annotators on document text
Annotation document = new Annotation(text);
pipeline.annotate(document);
但词性标注器效果不佳:
Adding annotator pos
Exception in thread "main" java.lang.RuntimeException: edu.stanford.nlp.io.RuntimeIOException: Unrecoverable error while loading a tagger model
at edu.stanford.nlp.pipeline.StanfordCoreNLP.create(StanfordCoreNLP.java:558)
at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:85)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:267)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:129)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:125)
我使用 Eclipse,我已经链接了 stanford-corenlp-3.4.jar,如下所示:
我只是将 stanford-corenlp-3.4-models.jar 添加到 Eclipse 的类路径中,它就可以工作了。
我需要使用 Java API 的 StanfordTruecaser。我有这个代码:
String text = "i love paris. i am with barack obama";
//define the properties of the pipeline to be run and add annotators to it
Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, truecase");
pipeline = new StanfordCoreNLP(props);
//run annotators on document text
Annotation document = new Annotation(text);
pipeline.annotate(document);
但词性标注器效果不佳:
Adding annotator pos
Exception in thread "main" java.lang.RuntimeException: edu.stanford.nlp.io.RuntimeIOException: Unrecoverable error while loading a tagger model
at edu.stanford.nlp.pipeline.StanfordCoreNLP.create(StanfordCoreNLP.java:558)
at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:85)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:267)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:129)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:125)
我使用 Eclipse,我已经链接了 stanford-corenlp-3.4.jar,如下所示:
我只是将 stanford-corenlp-3.4-models.jar 添加到 Eclipse 的类路径中,它就可以工作了。