nlp_sentiment_detector: Spark NLP SentimentDetector

View source: R/sentiment-detector.R

nlp_sentiment_detectorR Documentation

Spark NLP SentimentDetector

Description

Spark ML estimator that scores a sentence for a sentiment See https://nlp.johnsnowlabs.com/docs/en/annotators#sentimentdetector

Usage

nlp_sentiment_detector(
  x,
  input_cols,
  output_col,
  decrement_multiplier = NULL,
  dictionary_path,
  dictionary_delimiter = ",",
  dictionary_read_as = "TEXT",
  dictionary_options = list(format = "text"),
  enable_score = NULL,
  increment_multiplier = NULL,
  negative_multiplier = NULL,
  positive_multiplier = NULL,
  reverse_multiplier = NULL,
  uid = random_string("sentiment_detector_")
)

Arguments

x

A spark_connection, ml_pipeline, or a tbl_spark.

input_cols

Input columns. String array.

output_col

Output column. String.

decrement_multiplier

defaults to -2.0

dictionary_path

path to file with list of inputs and their content

dictionary_delimiter

delimiter in dictionary file

dictionary_read_as

TEXT or SPARK_DATASET

dictionary_options

options to pass to the Spark reader. Defaults to "format" = "text"

enable_score

if true, score will show as the double value, else will output string "positive" or "negative"

increment_multiplier

defaults to 2.0

negative_multiplier

defaults to -1.0

positive_multiplier

defaults to 1.0

reverse_multiplier

defaults to -1.0

uid

A character string used to uniquely identify the ML estimator.

Value

The object returned depends on the class of x.

  • spark_connection: When x is a spark_connection, the function returns an instance of a ml_estimator object. The object contains a pointer to a Spark Estimator object and can be used to compose Pipeline objects.

  • ml_pipeline: When x is a ml_pipeline, the function returns a ml_pipeline with the NLP estimator appended to the pipeline.

  • tbl_spark: When x is a tbl_spark, an estimator is constructed then immediately fit with the input tbl_spark, returning an NLP model.


r-spark/sparknlp documentation built on Oct. 15, 2022, 10:50 a.m.