简体   繁体   English

斯坦福pos-tagger文件错误

[英]Stanford pos-tagger file error

I am working on a project in c# and I have to integrate stanford pos-tagger API although I have done it but when I compile my code I get an error 我正在用C#开发一个项目,尽管我已经完成了stanford pos-tagger API,但是我在编译代码时遇到了错误

An exception of type 'edu.stanford.nlp.io.RuntimeIOException' occurred in stanford-postagger-3.6.0.dll but was not handled in user code stanford-postagger-3.6.0.dll中发生了'edu.stanford.nlp.io.RuntimeIOException'类型的异常,但未在用户代码中处理

Additional information: Error while loading a tagger model (probably missing model file) 附加信息:加载标记器模型时出错(可能缺少模型文件)

The line on which this error is pointing in my code is this: 此错误在我的代码中指向的行是:

var tagger = new MaxentTagger(@"..\..\..\..\paket-files\nlp.stanford.edu\stanford-postagger-full-2015-12-09\models\wsj-0-18-bidirectional-distsim.tagger");

Note: How I installed pos-tagger is by right clicking on my Solution then "manage nuget.org packages" and searched for stanford nlp tagger and installed it I have copied code from here : https://sergey-tihon.github.io/Stanford.NLP.NET/StanfordPOSTagger.html 注意:我如何安装pos-tagger是通过右键单击我的解决方案,然后“管理nuget.org软件包”并搜索stanford nlp tagger并安装它,我已经从此处复制了代码: https ://sergey-tihon.github.io /Stanford.NLP.NET/StanfordPOSTagger.html

95% chance that you're missing the CoreNLP models jar from your classpath. 您有95%的机会从类路径中丢失了CoreNLP模型罐。 You need to include not only the code jar, but also the models jar; 您不仅需要包括代码jar,还需要包括模型jar。 both included in the standard distribution. 都包含在标准发行版中。 For example, in Maven, you'd need: 例如,在Maven中,您需要:

<dependencies>
<dependency>
    <groupId>edu.stanford.nlp</groupId>
    <artifactId>stanford-corenlp</artifactId>
    <version>3.6.0</version>
</dependency>
<dependency>
    <groupId>edu.stanford.nlp</groupId>
    <artifactId>stanford-corenlp</artifactId>
    <version>3.6.0</version>
    <classifier>models</classifier>
</dependency>
</dependencies>

(The top entry is the code, the bottom entry is the models). (顶部是代码,底部是模型)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM