【问题标题】:Stanford pos-tagger file error斯坦福邮政标签文件错误
【发布时间】:2016-12-12 10:52:20
【问题描述】:

我正在使用 c# 开发一个项目,我必须集成 stanford pos-tagger API,尽管我已经完成了,但是当我编译我的代码时出现错误

发生“edu.stanford.nlp.io.RuntimeIOException”类型的异常 在 stanford-postagger-3.6.0.dll 但未在用户代码中处理

附加信息:加载标记器模型时出错(可能 缺少模型文件)

此错误在我的代码中指向的行是:

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

注意:我如何安装 pos-tagger 是通过右键单击我的解决方案然后“管理 nuget.org 包”并搜索 stanford nlp tagger 并安装它 我从这里复制了代码:https://sergey-tihon.github.io/Stanford.NLP.NET/StanfordPOSTagger.html

【问题讨论】:

    标签: c# .net stanford-nlp


    【解决方案1】:

    95% 的可能性是您从类路径中丢失了 CoreNLP 模型 jar。您不仅需要包含代码 jar,还需要包含模型 jar;两者都包含在标准分布中。例如,在 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>
    

    (顶部为代码,底部为模型)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-12
      • 1970-01-01
      • 2012-02-03
      • 2015-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多