Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Sentiment Analysis

Wikipedia

Python libraries:

from textblob import TextBlob

blob = TextBlob(text)

for sentence in blob.sentences:
    print(sentence.sentiment) # sentiment.polarity sentiment.subjectivity
Polarity
connotation +positive vs -negative (+happy vs -sad)
Subjectivity
+objective vs -subjective (+fact vs -opinion)

More materials