任何人都可以在发生此错误时帮助我。任何想法都非常感激。我需要添加任何内容,任何注释器。这是我从默认模型中传递的数据或模型的问题。
我正在使用Standford NLP 3.4.1来完成社交媒体数据的情绪计算。当我通过spark / scala作业运行时,我收到一些数据的跟随错误。
java.lang.IllegalArgumentException: annotator "sentiment" requires annotator "binarized_trees"
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:300)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:129)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:125)
at com.pipeline.sentiment.NonTwitterSentimentAndThemeProcessorAction$.create(NonTwitterTextEnrichmentComponent.scala:142)
at com.pipeline.sentiment.NonTwitterTextEnrichmentInitialized.action$lzycompute(NonTwitterTextEnrichmentComponent.scala:52)
at com.pipeline.sentiment.NonTwitterTextEnrichmentInitialized.action(NonTwitterTextEnrichmentComponent.scala:50)
at com.pipeline.sentiment.NonTwitterTextEnrichmentInitialized.action(NonTwitterTextEnrichmentComponent.scala:49)
这是我在scala中的代码
def create(features: Seq[String] = Seq("tokenize", "ssplit", "pos","parse","sentiment")): TwitterSentimentAndThemeAction = {
println("comes inside the TwitterSentimentAndThemeProcessorAction create method")
val props = new Properties()
props.put("annotators", features.mkString(", "))
props.put(""pos.model", "tagger/gate-EN-twitter.model");
props.put("parse.model", "tagger/englishSR.ser.gz");
val pipeline = new StanfordCoreNLP(props)
非常感谢任何帮助。谢谢你的帮助
答案 0 :(得分:1)
......你确定这是你得到的错误吗?使用您的代码,我收到错误
$sql = "SELECT COUNT(`author`) FROM " . $sql_bookshelfquery; // Write SQL
$sth = $dbh->prepare($sql); // Prepare query
$sth->execute(); // Execute query
$total_pages = $sth->fetchColumn(); // Fetch query result
这更有意义。 shift减少解析器模型的生命为
Loading parser from serialized file tagger/englishSR.ser.gz ...edu.stanford.nlp.io.RuntimeIOException: java.io.IOException: Unable to resolve "tagger/englishSR.ser.gz" as either class path, filename or URL
。如果我不使用shift reduce模型,那么编写的代码对我来说很好;同样,如果我在上面包含模型路径,它就可以正常工作。
我尝试的确切代码是:
edu/stanford/nlp/models/srparser/englishSR.ser.gz