带有 Stanford NLP 西班牙语 POS 标记的 NullPointerException
NullPointerException with Stanford NLP Spanish POS tagging
全部 -
运行 Stanford CoreNLP 3.4.1,加上西班牙语模型。我有一个包含大约 100 个 UTF-8 编码的西班牙语原始文本文档的目录。对于每一个,我执行以下命令行:
java -cp stanford-corenlp-3.4.1.jar:stanford-spanish-corenlp-2014-08-26-models.jar:xom.jar:joda-time.jar:jollyday.jar:ejml-0.23.jar -Xmx2g edu.stanford.nlp.pipeline.StanfordCoreNLP -props <propsfile> -file <txtfile>
道具文件如下所示:
annotators = tokenize, ssplit, pos
tokenize.language = es
pos.model = edu/stanford/nlp/models/pos-tagger/spanish/spanish-distsim.tagger
对于几乎每个文件,我都会收到以下错误:
线程中出现异常 "main" java.lang.RuntimeException:注释错误:
在 edu.stanford.nlp.pipeline.StanfordCoreNLP$15.run(StanfordCoreNLP.java:1287)
在 edu.stanford.nlp.pipeline.StanfordCoreNLP.processFiles(StanfordCoreNLP.java:1347)
在 edu.stanford.nlp.pipeline.StanfordCoreNLP.run(StanfordCoreNLP.java:1389)
在 edu.stanford.nlp.pipeline.StanfordCoreNLP.main(StanfordCoreNLP.java:1459)
原因:java.lang.NullPointerException
在 edu.stanford.nlp.tagger.maxent.ExtractorSpanishStrippedVerb.extract(ExtractorFramesRare.java:1626)
在 edu.stanford.nlp.tagger.maxent.Extractor.extract(Extractor.java:153)
在 edu.stanford.nlp.tagger.maxent.TestSentence.getExactHistories(TestSentence.java:465)
在 edu.stanford.nlp.tagger.maxent.TestSentence.getHistories(TestSentence.java:440)
在 edu.stanford.nlp.tagger.maxent.TestSentence.getHistories(TestSentence.java:428)
在 edu.stanford.nlp.tagger.maxent.TestSentence.getExactScores(TestSentence.java:377)
在 edu.stanford.nlp.tagger.maxent.TestSentence.getScores(TestSentence.java:372)
在 edu.stanford.nlp.tagger.maxent.TestSentence.scoresOf(TestSentence.java:713)
在 edu.stanford.nlp.sequences.ExactBestSequenceFinder.bestSequence(ExactBestSequenceFinder.java:91)
在 edu.stanford.nlp.sequences.ExactBestSequenceFinder.bestSequence(ExactBestSequenceFinder.java:31)
在 edu.stanford.nlp.tagger.maxent.TestSentence.runTagInference(TestSentence.java:322)
在 edu.stanford.nlp.tagger.maxent.TestSentence.testTagInference(TestSentence.java:312)
在 edu.stanford.nlp.tagger.maxent.TestSentence.tagSentence(TestSentence.java:135)
在 edu.stanford.nlp.tagger.maxent.MaxentTagger.tagSentence(MaxentTagger.java:998)
在 edu.stanford.nlp.pipeline.POSTaggerAnnotator.doOneSentence(POSTaggerAnnotator.java:147)
在 edu.stanford.nlp.pipeline.POSTaggerAnnotator.annotate(POSTaggerAnnotator.java:110)
在 edu.stanford.nlp.pipeline.AnnotationPipeline.annotate(AnnotationPipeline.java:67)
在 edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:847)
在 edu.stanford.nlp.pipeline.StanfordCoreNLP$15.run(StanfordCoreNLP.java:1275)
有什么想法吗?我什至还没有开始追踪这个。我确定问题出在 POS 中; tokenize 和 ssplit 运行得很好。
P.S。请不要说"Upgrade to 3.5.0";我目前没有安装 Java 8,也不想安装它。
提前致谢。
是的,似乎 3.4.1 西班牙语模型中存在错误。
西班牙语 3.5.0 模型实际上似乎与 Java7 兼容。您可以下载 3.5 (stanford-spanish-corenlp-2014-10-23-models.jar
) 中使用的模型并将其放在您的类路径中。这解决了我的问题 运行 Java 7 locally.
全部 -
运行 Stanford CoreNLP 3.4.1,加上西班牙语模型。我有一个包含大约 100 个 UTF-8 编码的西班牙语原始文本文档的目录。对于每一个,我执行以下命令行:
java -cp stanford-corenlp-3.4.1.jar:stanford-spanish-corenlp-2014-08-26-models.jar:xom.jar:joda-time.jar:jollyday.jar:ejml-0.23.jar -Xmx2g edu.stanford.nlp.pipeline.StanfordCoreNLP -props <propsfile> -file <txtfile>
道具文件如下所示:
annotators = tokenize, ssplit, pos
tokenize.language = es
pos.model = edu/stanford/nlp/models/pos-tagger/spanish/spanish-distsim.tagger
对于几乎每个文件,我都会收到以下错误:
线程中出现异常 "main" java.lang.RuntimeException:注释错误: 在 edu.stanford.nlp.pipeline.StanfordCoreNLP$15.run(StanfordCoreNLP.java:1287) 在 edu.stanford.nlp.pipeline.StanfordCoreNLP.processFiles(StanfordCoreNLP.java:1347) 在 edu.stanford.nlp.pipeline.StanfordCoreNLP.run(StanfordCoreNLP.java:1389) 在 edu.stanford.nlp.pipeline.StanfordCoreNLP.main(StanfordCoreNLP.java:1459) 原因:java.lang.NullPointerException 在 edu.stanford.nlp.tagger.maxent.ExtractorSpanishStrippedVerb.extract(ExtractorFramesRare.java:1626) 在 edu.stanford.nlp.tagger.maxent.Extractor.extract(Extractor.java:153) 在 edu.stanford.nlp.tagger.maxent.TestSentence.getExactHistories(TestSentence.java:465) 在 edu.stanford.nlp.tagger.maxent.TestSentence.getHistories(TestSentence.java:440) 在 edu.stanford.nlp.tagger.maxent.TestSentence.getHistories(TestSentence.java:428) 在 edu.stanford.nlp.tagger.maxent.TestSentence.getExactScores(TestSentence.java:377) 在 edu.stanford.nlp.tagger.maxent.TestSentence.getScores(TestSentence.java:372) 在 edu.stanford.nlp.tagger.maxent.TestSentence.scoresOf(TestSentence.java:713) 在 edu.stanford.nlp.sequences.ExactBestSequenceFinder.bestSequence(ExactBestSequenceFinder.java:91) 在 edu.stanford.nlp.sequences.ExactBestSequenceFinder.bestSequence(ExactBestSequenceFinder.java:31) 在 edu.stanford.nlp.tagger.maxent.TestSentence.runTagInference(TestSentence.java:322) 在 edu.stanford.nlp.tagger.maxent.TestSentence.testTagInference(TestSentence.java:312) 在 edu.stanford.nlp.tagger.maxent.TestSentence.tagSentence(TestSentence.java:135) 在 edu.stanford.nlp.tagger.maxent.MaxentTagger.tagSentence(MaxentTagger.java:998) 在 edu.stanford.nlp.pipeline.POSTaggerAnnotator.doOneSentence(POSTaggerAnnotator.java:147) 在 edu.stanford.nlp.pipeline.POSTaggerAnnotator.annotate(POSTaggerAnnotator.java:110) 在 edu.stanford.nlp.pipeline.AnnotationPipeline.annotate(AnnotationPipeline.java:67) 在 edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:847) 在 edu.stanford.nlp.pipeline.StanfordCoreNLP$15.run(StanfordCoreNLP.java:1275)
有什么想法吗?我什至还没有开始追踪这个。我确定问题出在 POS 中; tokenize 和 ssplit 运行得很好。
P.S。请不要说"Upgrade to 3.5.0";我目前没有安装 Java 8,也不想安装它。
提前致谢。
是的,似乎 3.4.1 西班牙语模型中存在错误。
西班牙语 3.5.0 模型实际上似乎与 Java7 兼容。您可以下载 3.5 (stanford-spanish-corenlp-2014-10-23-models.jar
) 中使用的模型并将其放在您的类路径中。这解决了我的问题 运行 Java 7 locally.