斯卡拉错误中的标准情绪分析

时间:2017-07-07 10:46:48

标签: scala stanford-nlp

当我尝试在Spark Scala上运行以下代码进行Sentiment Analysis时,我收到以下错误:

import org.apache.spark.sql.functions._
import com.databricks.spark.corenlp.functions._
import sqlContext.implicits._
val input = Seq((1, "<xml>Stanford University is located in California. 
It is a great university.</xml>")).toDF("id", "text")
val output=input.select(cleanxml('text).as('doc))
.select(explode(ssplit('doc)).as('sen)).select('sen, 
tokenize('sen).as('words), ner('sen).as('nerTags), 
sentiment('sen).as('sentiment))
output.show(truncate = false)
Error :
The val output is throwing the below error:
java.lang.NoSuchMethodError: 
scala.reflect.api.JavaUniverse.runtimeMirror(Ljava/lang/ClassLoader;)
Lscala/reflect/api/JavaMirrors$JavaMirror;
at com.databricks.spark.corenlp.functions$.cleanxml(functions.scala:54)
... 54 elided

1 个答案:

答案 0 :(得分:0)

似乎其他人遇到了这个问题并修复了它。

请参阅此处:https://github.com/databricks/spark-corenlp/issues/25并尝试按照说明操作。