StanfordNLP:命名实体识别的ArrayIndexOutOfBoundsException

时间:2017-04-20 04:23:07

标签: java nlp stanford-nlp

我正在尝试使用this短命名实体识别教程来学习NER。但我无法成功运行代码。我在那里提到了location.txt文件中的一个条目。

我收到ArrayIndexOutOfBoundsException错误。

09:32:09.431 [main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator regexner

java.lang.ArrayIndexOutOfBoundsException: 1

at  edu.stanford.nlp.pipeline.TokensRegexNERAnnotator.readEntries(TokensRegexNERAnnotator.java:696)
at edu.stanford.nlp.pipeline.TokensRegexNERAnnotator.readEntries(TokensRegexNERAnnotator.java:593)
at edu.stanford.nlp.pipeline.TokensRegexNERAnnotator.<init>(TokensRegexNERAnnotator.java:294)
at edu.stanford.nlp.pipeline.AnnotatorImplementations.tokensRegexNER(AnnotatorImplementations.java:135)
at edu.stanford.nlp.pipeline.AnnotatorFactories$7.create(AnnotatorFactories.java:305)
at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:152)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:451)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:154)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:150)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:137)

请帮助我。 提前谢谢。

1 个答案:

答案 0 :(得分:1)

以下是rexegner规则的示例:

London    LOCATION    MISC    1

确保4列用&#34; \ t&#34;字符不是空格。