Issue using Stanford CoreNLP parsing models

2020-07-21 00:10发布

问题:

I cannot find the Stanford parsing models for German and French: there is no "germanPCFG.ser.gz" or "frenchFactored.ser.gz" in the jar (stanford-corenlp-3.2.0-models.jar) - only english. Have searched through posttagger jar too.

Same issue encountered at : How to use Stanford CoreNLP with a Non-English parse model?

回答1:

You can find them in the download for the Stanford Parser. Look in the models.jar file.



回答2:

With Maven you can use

<dependency>
  <groupId>edu.stanford.nlp</groupId>
  <artifactId>stanford-corenlp</artifactId>
  <version>3.5.2</version>
</dependency>

<dependency>
  <groupId>edu.stanford.nlp</groupId>
  <artifactId>stanford-corenlp</artifactId>
  <version>3.5.2</version>
  <classifier>models</classifier>         <!-- English models -->
</dependency>

<dependency>
  <groupId>edu.stanford.nlp</groupId>
  <artifactId>stanford-corenlp</artifactId>
  <version>3.5.2</version>
  <classifier>models-german</classifier>  <!-- German models -->
</dependency>

<dependency>
  <groupId>edu.stanford.nlp</groupId>
  <artifactId>stanford-corenlp</artifactId>
  <version>3.5.2</version>
  <classifier>models-spanish</classifier>
</dependency>

<dependency>
  <groupId>edu.stanford.nlp</groupId>
  <artifactId>stanford-corenlp</artifactId>
  <version>3.5.2</version>
  <classifier>models-chinese</classifier>
</dependency>

Maven will download the jar file for the german models to your home directory:
~/.m2/repository/edu/stanford/nlp/stanford-corenlp/3.5.2/stanford-corenlp-3.5.2-models-german.jar