java - 斯坦福自然语言处理 : ArrayIndexOutOfBoundsException for Named Entity Recognition

标签 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)

请帮助我。 提前致谢。

最佳答案

以下是 rexegner 规则示例:

London    LOCATION    MISC    1

确保 4 列之间用“\t”字符而不是空格分隔。

关于java - 斯坦福自然语言处理 : ArrayIndexOutOfBoundsException for Named Entity Recognition,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43510163/

相关文章:

java - 在构建文档时验证 java 中的 xml

python - 我在哪里可以找到包含常见食物列表的文本列表或图书馆?

java - 使用标准 corenlp 包获取 corefrences

java - Stanford OpenIE 示例代码编译错误

java - 使用 Google Protocol Buffer JAR 文件构建 Java 应用程序

java - org.apache.poi.EncryptedDocumentException : Unsupported hash algorithm

java检查特定位置的管理员权限

python - 为什么 Tfidfvectorizer 中的 token_pattern 参数不能与 scikit learn 一起使用?

python - 运行 CRFSuite 示例

stanford-nlp - Stanford Parser的标签