databricks/spark-corenlp

How to use this lib in java

LinRick opened this issue · 0 comments

Hi all,
Would you tell me how to use this lib in java?
I can import it, but i do not know to use.
"import com.databricks.spark.corenlp.functions;"
The maven project pom.xml:

databricks
spark-corenlp
0.2.0-s_2.11

In the following, there is my program.
SparkSession spark = SparkSession.builder().getOrCreate();
JavaSparkContext sc = new JavaSparkContext(spark.sparkContext());
StructField[] structFields = new StructField[]{
new StructField("intColumn", DataTypes.IntegerType, true, Metadata.empty()),
new StructField("stringColumn", DataTypes.StringType, true, Metadata.empty())
};

StructType structType = new StructType(structFields);

List rows = new ArrayList<>();
rows.add(RowFactory.create(1, "Stanford University is located in California. " +
"It is a great university."));

Dataset df = spark.createDataFrame(rows, structType);

System.out.println("Test Count = " + df.count());

df.show();

Rick