TokensRegex抛出异常

时间:2017-04-07 14:54:35

标签: regex

我有以下正则表达式部分工作,需要帮​​助才能使其适用于我的所有用例。

正则表达式:

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

以上表达式适用于以下情况:

by market and shipping
by market, shipping and region

但是,正则表达式将失败以下:

by market

任何人都可以帮我写正确的正则表达式。

更新:

以下是异常的堆栈跟踪:

[pool-1-thread-7] INFO CoreNLP - [/ 0:0:0:0:0:0:0:1:64476] API调用w / annotators tokenize,ssplit,pos,lemma,ner, regexner,解析,depparse,natlog,提,COREF,openie,KBP 按市场 [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器标记化 [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器ssplit [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器pos [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释引理 [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器 [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器regexner [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器解析 [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器depparse [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器natlog [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器提及 [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器coref [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器openie [pool-1-thread-7] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器kbp 显示java.lang.NullPointerException         在edu.stanford.nlp.pipeline.StanfordCoreNLPServer $ TokensRegexHandler.lambda $ null $ 365(StanfordCoreNLPServer.java:814)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.object(JSONOutputter.java:453)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.routeObject(JSONOutputter.java:352)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.lambda $ object $ 344(JSONOutputter.java:467)         在edu.stanford.nlp.pipeline.StanfordCoreNLPServer $ TokensRegexHandler.lambda $ null $ 366(StanfordCoreNLPServer.java:808)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.object(JSONOutputter.java:453)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.routeObject(JSONOutputter.java:352)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.routeObject(JSONOutputter.java:330)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.routeObject(JSONOutputter.java:354)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.lambda $ object $ 344(JSONOutputter.java:467)         在edu.stanford.nlp.pipeline.StanfordCoreNLPServer $ TokensRegexHandler.lambda $ null $ 368(StanfordCoreNLPServer.java:803)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.object(JSONOutputter.java:453)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.object(JSONOutputter.java:474)         在edu.stanford.nlp.pipeline.JSONOutputter $ JSONWriter.objectToJSON(JSONOutputter.java:500)         在edu.stanford.nlp.pipeline.StanfordCoreNLPServer $ TokensRegexHandler.lambda $ handle $ 369(StanfordCoreNLPServer.java:795)         at java.util.concurrent.FutureTask.run(FutureTask.java:266)         在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)         at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)         在java.lang.Thread.run(Thread.java:745)

0 个答案:

没有答案