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

**`class VaderSentiment(config)`**

Bases: [`Classifier`](squirro.lib.nlp.steps.classifiers.Classifier.md#squirro.lib.nlp.steps.classifiers.Classifier)

The Vader Sentiment [`Classifier`](squirro.lib.nlp.steps.classifiers.Classifier.md#squirro.lib.nlp.steps.classifiers.Classifier) applies [rule based sentiment analysis](https://github.com/cjhutto/vaderSentiment) (positive, neutral, negative) on a string. Vader sentiment provides among others a compound score to detect sentiment, which we take for the classification.

**Note - Following strategy has been applied:**

- positive: compound score>=0.05
- neutral: compound score between -0.05 and 0.05
- negative: compound score<=-0.05

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

**Output** - the output field is filled with data of type [`dict`](https://docs.python.org/3.11/library/stdtypes.html#dict) { [`str`](https://docs.python.org/3.11/library/stdtypes.html#str), [`float`](https://docs.python.org/3.11/library/functions.html#float) }. The key of the [`dict`](https://docs.python.org/3.11/library/stdtypes.html#dict) is the predicted class name and the value is the sentiment score.

Parameters

`type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – vadersentiment

**Example**

```json
{
    "step":"classifier",
    "type":"vadersentiment",
    "input_fields":["body"],
    "output_field":"prediction",
    "label_field": ""
}
```

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)
