Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stanford Core NLP LexicalizedParser Model

I am new to NLP. I am trying a sample program with LexicalizedParser but am not able to locate the model.

String parseModel = "...../models/lexparser/englishPCFG.ser.gz";
LexicalizedParser lecicalizedParser = LexicalizedParser.loadModel(parseModel);

I have the required stanford-core-nlp-3.5.2.jar and the ner jar too in build path of a sample Java application.

I tried referring the absolute path of the core jar and load it but could not. :(

How can I refer to the exact location of this model from my program code?

A big thank you for any help and all help!

like image 701
raikumardipak Avatar asked Sep 27 '22 07:09

raikumardipak


1 Answers

If you use maven, make sure you include both of these dependencies in you pom.xml

<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>
</dependency>

This model englishPCFG.ser.gz
is inside package edu.stanford.nlp.models.lexparser
that is inside stanford-corenlp-3.5.2-models.jar

So you should use this path:

String parseModel = "edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz"
like image 125
Manos Nikolaidis Avatar answered Sep 30 '22 06:09

Manos Nikolaidis