SentimentTermNormalizer#

class SentimentTermNormalizer(config)#

Bases: Normalizer

Extracts positive and negative terms/phrases from given text. It tries to detect negations and phrases based on detected Vader-Valence-Terms. Extracted phrases are ranked according to their sentiment-polarity (valence score).

Input - all input fields need to be of type str.

Output - the output fields positive_terms and negative_terms are filled with data of type list [ str ].

Parameters
  • step (str, "normalizer") – The step

  • type (str, "sentiment_terms") – Custom extractor

  • fields (list, ["body"]) – Input text

  • take_top_n_terms (int, 10) – Extract top-N positive / negative ranked phrases (by polarity)

Example

{
    "step": "normalizer",
    "type": "sentiment_terms",
    "fields": ["body"]
}

Methods Summary

process_doc(doc)

Process a document

Methods Documentation

process_doc(doc)#

Process a document

Parameters

doc (Document) – Document

Returns

Processed document

Return type

Document