<!-- Source: https://docs.squirro.com/en/latest/api/squirro.lib.nlp.steps.normalizers.SentimentTermNormalizer.html -->
# SentimentTermNormalizer

**`class SentimentTermNormalizer(config)`**

Bases: [`Normalizer`](squirro.lib.nlp.steps.normalizers.Normalizer.md#squirro.lib.nlp.steps.normalizers.Normalizer)

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

**Input** - all input fields need to be of type [`str`](https://docs.python.org/3.11/library/stdtypes.html#str).

**Output** - the output fields positive_terms and negative_terms are filled with data of type [`list`](https://docs.python.org/3.11/library/stdtypes.html#list) [ [`str`](https://docs.python.org/3.11/library/stdtypes.html#str) ].

Parameters

- `step` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"normalizer"`) – The step
- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"sentiment_terms"`) – Custom extractor
- `fields` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`, ``[``"body"``]`) – Input text
- `take_top_n_terms` ([`int`](https://docs.python.org/3.11/library/functions.html#int)`, ``10`) – Extract top-N positive / negative ranked phrases (by polarity)

**Example**

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

Methods SummaryMethods Documentation

**`process_doc(doc)`**

Process a document

Parameters

`doc` ([`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)) – Document

Returns

Processed document

Return type

[Document](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)
