What is sentiment analysis?
Sentiment analysis using python
Sentiment analysis comes under NLP(Natural language processing) which is a sub branch of AI. It is used to measure the positivity, negativity or neutrality of a sentence, paragraph or a document.
How it does the measurement?
Here in the example we will be using a package called textblob in python to do this job. This package will be having a pre-trained classifier trained on movie reviews corpus.
In the movie review corpus, there will be a huge set of positive movie reviews (good movie reviews), negative movie reviews (bad movie reviews) and neutral movie reviews. So the classifier can efficiently identify and measure the positivity, negativity or neutrality of a given sentence.
Where is it useful?
There is no point in learning something new unless we don't know where it can be used. Application of sentiment analysis is plenty. Some of them are listed below,
- Customer feed back analytics.
- Measuring the rudeness in a letter.
- Business analytics.
- Social media analytics.
Sample Code and output:
In the above example -ve value means a negative sentiment, +ve value means a positive sentiment and 0.0 is neutral.