gpt4 book ai didi

java - 斯坦福 corenlp : Unrecoverable error while loading a tagger model

转载 作者:行者123 更新时间:2023-12-01 11:49:36 26 4
gpt4 key购买 nike

我需要使用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$4.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,如下所示: enter image description here

最佳答案

我只是将 stanford-corenlp-3.4-models.jar 添加到 Eclipse 中的类路径中,它就可以工作了。

关于java - 斯坦福 corenlp : Unrecoverable error while loading a tagger model,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28902103/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com