Sentiment analysis types and approaches

Sentiment Analysis in Python

Violeta Misheva

Data Scientist

Levels of granularity

  1. Document level

  2. Sentence level

  3. Aspect level

The camera in this phone is pretty good but the battery life is disappointing.

Sentiment Analysis in Python

Type of sentiment analysis algorithms

  • Rule/lexicon-based

nice:+2, good:+1, terrible: -3 ...

Today was a good day.

  Today: 0, was:0, a:0, good:+1, day:0
  Total valence: +1

 

  • Automatic/ Machine learning
Sentiment Analysis in Python

What is the valence of a sentence?

text = "Today was a good day."
from textblob import TextBlob

my_valence = TextBlob(text)
my_valence.sentiment
Sentiment(polarity=0.7, subjectivity=0.6000000000000001)
Sentiment Analysis in Python

Automated or rule-based?

Automated/Machine learning

  • Rely on having labelled historical data
  • Might take a while to train
  • Latest machine learning models can be quite powerful

Rule/lexicon-based

  • Rely on manually crafted valence scores
  • Different words might have different polarity in different contexts
  • Can be quite fast
Sentiment Analysis in Python

Let's practice!

Sentiment Analysis in Python

Preparing Video For Download...