使用REST API使用以下模式调用TokensRegex时出现异常:
([{word:/by/}][{tag:NN}]+)(/and|,/[{tag:NN}|{tag:VBG}]*)*
但是,当我使用Web界面针对同一本地服务器调用TokensRegex时,我得到了正确的响应。我假设web接口在调用rest 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 :(得分:0)
我使用了这个命令,它返回了匹配的文本而没有任何错误:
wget --post-data 'The car drove down the street.' 'localhost:9000/tokensregex?pattern=(/car/ [{pos:VBD}] )'