From the course: Text Analytics and Predictions with Python Essential Training

Finding sentiments - Python Tutorial

From the course: Text Analytics and Predictions with Python Essential Training

Start my 1-month free trial

Finding sentiments

- [Instructor] For sentiment analysis, we use the textblob package in Python nltk. It contains the class textblob which provide sentiment analysis out of the box. If you have not installed textblob already, please do so by using the command pip-install -U testblob from the Anaconda prompt. In order to do sentiment analysis, we iterate through the list of reviews and create the textblob object with each review. This step automatically does sentiment analysis and stores the results in the variable sentiment. Then we print out the review Text, Polarity and Subjectivity of the reviews one by one. Let us execute this code. If you look at the fourth review, nothing beats a good Marvel movie. The polarity is .7 which points to a highly positive review. It also has a subjectivity of .6. On the other hand, if you look at the third review, I couldn't believe how boring this movie is. It has a highly negative review of value of minus .51. As you look at the reviews and their scores, you would see a good match between the review and the scores. How do you summarize the individual scores? We will see that in the next video.

Contents