2017-03-03 38 views
1

我正在打電話與下列模式TokensRegex使用REST API時的異常:什麼是正確的編碼參數傳遞給TokensRegex

([{word:/by/}][{tag:NN}]+)(/and|,/[{tag:NN}|{tag:VBG}]*)* 

然而,當我使用Web界面調用對TokensRegex同一臺本地服務器,我得到了正確的迴應。我假設Web界面在調用其餘API之前對模式進行編碼。

在我的java程序中,我用「UTF-8」編碼參數,但是我得到了異常。

任何幫助將不勝感激。

唯一的例外是:

java.lang.NullPointerException 
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer$TokensRegexHandler.lambda$null$365(StanfordCoreNLPServer.java:814) 
at edu.stanford.nlp.pipeline.JSONOutputter$JSONWriter.object(JSONOutputter.java:453) 
at edu.stanford.nlp.pipeline.JSONOutputter$JSONWriter.routeObject(JSONOutputter.java:352) 
at edu.stanford.nlp.pipeline.JSONOutputter$JSONWriter.lambda$object$344(JSONOutputter.java:467) 
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer$TokensRegexHandler.lambda$null$366(StanfordCoreNLPServer.java:808) 
+0

顯示你的實際工作中的代碼通常更容易獲得良好的答案 – SergGr

回答

0

我用這個命令,並將其返回沒有任何錯誤匹配的文本:

wget --post-data 'The car drove down the street.' 'localhost:9000/tokensregex?pattern=(/car/ [{pos:VBD}])' 
相關問題