本文介绍了Stanford Core NLP LexicalizedParser模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是NLP的新手.我正在尝试使用LexicalizedParser的示例程序,但是无法找到模型.

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);

在示例Java应用程序的构建路径中,我也具有所需的stanford-core-nlp-3.5.2.jar和ner jar.

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

我尝试引用核心jar的绝对路径并加载它,但是没有. :(

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!

推荐答案

如果您使用maven,请确保在您的pom.xml

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>

此型号englishPCFG.ser.gz
在包edu.stanford.nlp.models.lexparser
中在stanford-corenlp-3.5.2-models.jar

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"

这篇关于Stanford Core NLP LexicalizedParser模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-09 23:27