【问题标题】:Using SemanticGraphCoreAnnotations in Stanford CoreNLP在斯坦福 CoreNLP 中使用 SemanticGraphCoreAnnotations
【发布时间】:2016-09-12 12:38:05
【问题描述】:

我想使用来自http://nlp.stanford.edu/software/openie.html 的示例代码,但行

 System.out.println(sentence.get(SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation.class).toString(SemanticGraph.OutputFormat.LIST));

给出错误

SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation 不能 解析为一个类型

即使我导入了 edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations。 Eclipse 建议进行以下快速修复:

更改为“AlternativeDependenciesAnnotation” (edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations;)

更改为“BasicDependenciesAnnotation” (edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations;)

应用第一个修复会导致 java.lang.NullPointerException,而第二个修复会给出以下结果,但第一句话的结果并不令人满意:

从加载子句搜索器 edu/stanford/nlp/models/naturalli/clauseSearcherModel.ser.gz...1.0 奥巴马 在夏威夷熊

导入edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation;无法解决和import import edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations;也无济于事。

我导入了 JAR

  • 乔达时间
  • stanford-corenlp-3.6.0
  • stanford-corenlp-3.6.0-models
  • ejml-0.23
  • 欢乐日
  • xom
  • slf4j
  • slf4j-简单

我使用 CoreNLP 3.6.0。 .我检查了 edu.stanford.nlp.semgraph 中的 SemanticGraphCoreAnnotations.java ,它包含 EnhancedDependenciesAnnotation.class 。我该如何解决这个问题?

【问题讨论】:

    标签: stanford-nlp


    【解决方案1】:

    示例代码似乎是为最新版本的 OpenIE 编写的,目前仅在 GitHub 上。让它运行的最简单方法可能是克隆 repository 并自己编译 CoreNLP。

    【讨论】:

      【解决方案2】:

      使用stanford-corenlp-3.9.2jar。这对我有用。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-03-17
        • 1970-01-01
        • 2020-05-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多