VaderSentiment

class squirro.lib.nlp.steps.classifiers.VaderSentiment(config)

Bases: squirro.lib.nlp.steps.classifiers.Classifier

The Vader Sentiment Classifier applies rule based sentiment analysis (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.

Output - the output field is filled with data of type dict { str, float }. The key of the dict is the predicted class name and the value is the sentiment score.

Parameters

type (str) – vadersentiment

Example

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

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