所以我们有一个可以获取数据的螺栓并尝试使用StanfordNLP解析它。主要目标是识别实体,对句子中的单词进行分类并尝试查找提及。这是StanfordCoreNLP对象的设置。请注意,我也在这里添加了推特模型。
Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
props.put("pos.model", "gate-EN-twitter.model");
props.put("dcoref.score", true);
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
起初,启动需要一段时间,所以我们将confvisor.worker.start.timeout.secs增加到了conf / storm.yaml内部的300。
现在,虽然它运行起来却很慢......而且,我们得到了奇怪的例外。喜欢这个
java.lang.ArrayIndexOutOfBoundsException:-1 at java.util.ArrayList.elementData(ArrayList.java:403)〜[na:1.8.0_05] 在java.util.ArrayList.get(ArrayList.java:416)〜[na:1.8.0_05] 在edu.stanford.nlp.dcoref.RuleBasedCorefMentionFinder.funkyFindLeafWithApproximateSpan(RuleBasedCorefMentionFinder.java:418)〜[stormjar.jar:na] 在edu.stanford.nlp.dcoref.RuleBasedCorefMentionFinder.findSyntacticHead(RuleBasedCorefMentionFinder.java:346)〜[stormjar.jar:na] 在edu.stanford.nlp.dcoref.RuleBasedCorefMentionFinder.findHead(RuleBasedCorefMentionFinder.java:274)〜[stormjar.jar:na] 在edu.stanford.nlp.dcoref.RuleBasedCorefMentionFinder.extractPredictedMentions(RuleBasedCorefMentionFinder.java:100)〜[stormjar.jar:na] 在edu.stanford.nlp.pipeline.DeterministicCorefAnnotator.annotate(DeterministicCorefAnnotator.java:107)〜[stormjar.jar:na] 在edu.stanford.nlp.pipeline.AnnotationPipeline.annotate(AnnotationPipeline.java:67)〜[stormjar.jar:na] 在edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:881)〜[stormjar.jar:na]
有关如何在Apache Storm中设置StanfordNLP螺栓的最佳实践吗?
谢谢!