2016-11-07 28 views
1

嘿,我想用斯德福德文字與斯坦福NLP服務器。我測試了http://corenlp.run/,它在德語中工作正常。如果我試試我自己的機器 使用斯德哥爾摩NLP服務器「無法處理傳入註釋」在德國

對Java -mx4g -cp 「*」 edu.stanford.nlp.pipeline.StanfordCoreNLPServer [港口] [超時]

它只是在工作英語。如果我選擇德國我得到錯誤信息

無法處理傳入的註釋

命令行顯示:

顯示java.lang.NullPointerException在 java.util.Properties $ LineReader.readLine(Properties.java:434)at java.util.Properties.load0(Properties.java:353)at java.util.Properties.load(Properties.java:341)at edu.stanford.nlp。 pipeline.S tanfordCoreNLPServer $ CoreNLPHandler.getProperties(StanfordCoreNLPServer.java:681) 在 edu.stanford.nlp.pipeline.StanfordCoreNLPServer $ CoreNLPHandler.handle(StanfordCoreNLPServer.java:540) 在com.sun.net.httpserver.Filter $ Chain.doFilter (Filter.java:79)at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)at com.sun.net.httpserver.Filter $ Chain.doFilter(Filter.java:82)at sun .net.httpserver.ServerImpl $ Exchange $ LinkHandler.handle(ServerImpl.java:675) at com.sun.net.httpserver.Filter $ Chain.doFilter(Filter.java:79)at sun.net.httpserver.ServerImpl $ Exchange.run(ServerImpl.java:647)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) a牛逼 java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745)

我quess我要補充德國.jar文件在某處,但我無法找到如何和在哪裏?

回答

0

好吧,我解壓德文.jar文件,並在那裏使用屬性文件,這樣就鎖定了。

annotators = tokenize, ssplit, pos, ner, parse 

tokenize.language = de 

pos.model = edu/stanford/nlp/models/pos-tagger/german/german-hgc.tagger 

ner.model = edu/stanford/nlp/models/ner/german.conll.hgc_175m_600.crf.ser.gz 
ner.applyNumericClassifiers = false 
ner.useSUTime = false 

parse.model = edu/stanford/nlp/models/lexparser/germanFactored.ser.gz 

# depparse 
depparse.model = edu/stanford/nlp/models/parser/nndep/UD_German.gz 
depparse.language = german 

我啓動了服務器這樣

java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -props StanfordCoreNLP-german.properties 

但還是德國是行不通的。

我無法找到如何處理「*」。我也試圖

<dependency> 
    <groupId>edu.stanford.nlp</groupId> 
    <artifactId>stanford-corenlp</artifactId> 
    <version>3.7.0</version> 
    <classifier>models-german</classifier> 
</dependency> 

添加到pom.xml中

+0

順便說一句,3.7.0目前不在Maven中,所以將它添加到pom.xml中將不起作用。 – StanfordNLPHelp

0

3.7.0目前正處於測試模式。

所以一定要重新下載3.7.0的最新副本。

如果你開始使用此命令的服務器:

java -Xmx8g edu.stanford.nlp.pipeline.StanfordCoreNLPServer 

注意:您將需要所有的罐子在

stanford-corenlp-full-2016-10-31/* 

stanford-german-corenlp-models-current.jar 

在CLASSPATH此命令工作。在德國的jar文件中有一些路徑問題,所以我現在重新下載它,因爲我現在只是修復它。

使用此命令發出您的要求:

wget --post-data '<insert German text here...>' 'localhost:9000/?properties={"annotators":"tokenize,ssplit,pos,ner,parse","pipelineLanguage":"de","outputFormat":"json"}' -O - 

它應該工作的罰款!

注:爲了把罐子在CLASSPATH中,你可以發出此命令:

export CLASSPATH=/path/to/stanford-corenlp-full-2016-10-31/*:/path/to/stanford-german-corenlp-models-current.jar 

(更換/路/給在任何地方的資源是你的機器)

,或當你調用java你可以指定一個CLASSPATH,就像這樣:

java -cp "/path/to/stanford-corenlp-full-2016-10-31/*:/path/to/stanford-german-corenlp-models-current.jar" ... 

服務器查找在加載德國性質的要求「pipelineLanguage」屬性,因此,使用「丙」與edu.stanford。 nlp.pipeline.StanfordCoreNLPServer不起作用。