【问题标题】:stanford corenlp: Unrecoverable error while loading a tagger modelstanford corenlp:加载标记器模型时出现不可恢复的错误
【发布时间】:2015-03-06 15:31:30
【问题描述】:

我需要通过 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

【问题讨论】:

  • 不,该怎么做?
  • 您是否也下载了正确的 models.jar 并将其添加到您的类路径中?
  • 我忘记了models.jar。现在可以了。

标签: java eclipse stanford-nlp


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-02
    • 2022-06-21
    • 2012-11-22
    • 2018-05-15
    • 1970-01-01
    相关资源
    最近更新 更多