class_docstr: Trains a rule based sentiment detector, which calculates a score based on
  predefined keywords.
  
  A dictionary of predefined sentiment keywords must be provided with
  :meth:`.setDictionary`, where each line is a word delimited to its class
  (either ``positive`` or ``negative``). The dictionary can be set in the form
  of a delimited text file.
  
  By default, the sentiment score will be assigned labels ``"positive"`` if
  the score is ``>= 0``, else ``"negative"``.
  
  For extended examples of usage, see the `Examples
  <https://github.com/JohnSnowLabs/spark-nlp/blob/master/examples/python/training/english/dictionary-sentiment/sentiment.ipynb>`__.
  
  ====================== ======================
  Input Annotation types Output Annotation type
  ====================== ======================
  ``TOKEN, DOCUMENT``    ``SENTIMENT``
  ====================== ======================
  
  Parameters
  ----------
  dictionary
      path for dictionary to sentiment analysis
  
  Examples
  --------
  In this example, the dictionary ``default-sentiment-dict.txt`` has the form
  of::
  
      ...
      cool,positive
      superb,positive
      bad,negative
      uninspired,negative
      ...
  
  where each sentiment keyword is delimited by ``","``.
  
  >>> import sparknlp
  >>> from sparknlp.base import *
  >>> from sparknlp.annotator import *
  >>> from pyspark.ml import Pipeline
  >>> documentAssembler = DocumentAssembler() \
  ...     .setInputCol("text") \
  ...     .setOutputCol("document")
  >>> tokenizer = Tokenizer() \
  ...     .setInputCols(["document"]) \
  ...     .setOutputCol("token")
  >>> lemmatizer = Lemmatizer() \
  ...     .setInputCols(["token"]) \
  ...     .setOutputCol("lemma") \
  ...     .setDictionary("lemmas_small.txt", "->", "\t")
  >>> sentimentDetector = SentimentDetector() \
  ...     .setInputCols(["lemma", "document"]) \
  ...     .setOutputCol("sentimentScore") \
  ...     .setDictionary("default-sentiment-dict.txt", ",", ReadAs.TEXT)
  >>> pipeline = Pipeline().setStages([
  ...     documentAssembler,
  ...     tokenizer,
  ...     lemmatizer,
  ...     sentimentDetector,
  ... ])
  >>> data = spark.createDataFrame([
  ...     ["The staff of the restaurant is nice"],
  ...     ["I recommend others to avoid because it is too expensive"]
  ... ]).toDF("text")
  >>> result = pipeline.fit(data).transform(data)
  >>> result.selectExpr("sentimentScore.result").show(truncate=False)
  +----------+
  |result    |
  +----------+
  |[positive]|
  |[negative]|
  +----------+
  
  See Also
  --------
  ViveknSentimentApproach : for an alternative approach to sentiment extraction
code: def __init__(self):
      super(SentimentDetector, self).__init__(
          classname="com.johnsnowlabs.nlp.annotators.sda.pragmatic.SentimentDetector"
      )
      self._setDefault(
          positiveMultiplier=1.0,
          negativeMultiplier=-1.0,
          incrementMultiplier=2.0,
          decrementMultiplier=-2.0,
          reverseMultiplier=-1.0,
          enableScore=False,
      )
  
file_path: spark-nlp/python/sparknlp/annotator/sentiment/sentiment_detector.py
imports: from sparknlp.common import *
label_desc: Use image node_id 1 to create a new SentimentDetector object from inherited base classes: AnnotatorApproach with example: obj = SentimentDetector()