0

I want to use the example code from http://nlp.stanford.edu/software/openie.html but the line

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

gives the error

SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation cannot be resolved to a type

even though I imported edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations. Eclipse suggests following quick fixes:

Change to "AlternativeDependenciesAnnotation" (edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations;)

Change to "BasicDependenciesAnnotation" (edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations;)

Applying the first fix leads to an java.lang.NullPointerException while the second fix gives following, rather unsatisfying results for the first sentence:

Loading clause searcher from edu/stanford/nlp/models/naturalli/clauseSearcherModel.ser.gz...1.0 Obama be bear in Hawaii

The import edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation; cannot be resolved and the import import edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations; does not help either.

I imported the JARs

  • joda-time
  • stanford-corenlp-3.6.0
  • stanford-corenlp-3.6.0-models
  • ejml-0.23
  • jollyday
  • xom
  • slf4j
  • slf4j-simple

I use CoreNLP 3.6.0. . I checked the SemanticGraphCoreAnnotations.java in edu.stanford.nlp.semgraph and it contains the EnhancedDependenciesAnnotation.class . How can I fix this issue?

2 Answers 2

1

It seems like the example code was written for the latest version of OpenIE, which is so far only on GitHub. The easiest way of getting this to run would probably be to clone the repository and compile CoreNLP yourself.

0

Use the stanford-corenlp-3.9.2 jar. This worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.