2016-12-12 78 views
0

我在C#中的一個項目工作,我有整合斯坦福POS-惡搞API雖然我已經做了,但是當我編譯我的代碼,我得到一個錯誤斯坦福POS-惡搞文件錯誤

例外在斯坦福大學postagger-3.6.0.dll型「edu.stanford.nlp.io.RuntimeIOException」的發生 但在用戶代碼中沒有處理

其他信息:加載捉模型錯誤(可能 缺失模型文件)

該行上出現該錯誤在我的代碼指向是這樣的:

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

注:我如何安裝POS-惡搞是通過右鍵點擊我的解決方案,然後「管理nuget.org套餐」和搜索斯坦福nlp tagger並安裝它 我已經從這裏複製代碼:https://sergey-tihon.github.io/Stanford.NLP.NET/StanfordPOSTagger.html

回答

0

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> 

(頂部條目是代碼,底部條目是模型)。