nltk.sentiment.SentimentIntensityAnalyzer

class nltk.sentiment.SentimentIntensityAnalyzer[source]

Bases: object

Give a sentiment intensity score to sentences.

__init__(lexicon_file='sentiment/vader_lexicon.zip/vader_lexicon/vader_lexicon.txt')[source]
make_lex_dict()[source]

Convert lexicon file to a dictionary

polarity_scores(text)[source]

Return a float for sentiment strength based on the input text. Positive values are positive valence, negative value are negative valence.

Note

Hashtags are not taken into consideration (e.g. #BAD is neutral). If you are interested in processing the text in the hashtags too, then we recommend preprocessing your data to remove the #, after which the hashtag text may be matched as if it was a normal word in the sentence.

sentiment_valence(valence, sentitext, item, i, sentiments)[source]
score_valence(sentiments, text)[source]