Sentiment Analysis Project in python using NLTK Library ( With Google Colab Notebook)

Share this post

In this post, we are implementing a real-time application of Natural Language Processing. We are going to implement the Amazon review sentiment analysis project using NLTK Library and Machine Learning in the python programming language.

After reading this post, you can able to learn how amazon figures out negative, positive, and neutral response and their percentages as shown at the end of every product in Amazon. I recommend that before going in deep with the project, first go to a product in amazon and see how the reviews are classified, and how the performance measured for a product. 
                                      Amazon Product - Adidas Men Shoes

Table of Contents

  1. What is the Sentiment Analysis?
  2. What is Natural Language Processing?
  3. Why we need Sentiment Analysis?
  4. How to build a powerful sentiment analysis in python?
  5. How Tech against like Google, Amazon, Twitter using Sentiment Analysis?
  6. Applications of Sentiment Analysis 

What is the Sentiment Analysis?

Sentiment analysis is about finding the feel in the sentence as positive, negative, or neutral. For example, consider the following sentences.

Sentence 1 --  "Good Product, I strongly recommend " ( Positive)
Sentence 2 -- " Damaged product received and very poor quality. I want my money back " (Negative)
Sentence 3 -- " It is okay to buy this one " ( Neutral)

By reading the first sentence we can feel that sentence is positive. Think if we have 100 lakh reviews, it is very hard and more complex to make this review analysis. In this context, Machine Learning algorithms do a great job with more efficiency within seconds of time.  To Implement a Machine Learning Algorithm for this application, we are taking a real-time dataset collected from an Amazon Product and performing sentiment analysis on reviews. 


What is Natural Language Processing?

Natural Language Processing is a subsection of Machine Learning that deals mostly with Natural data generated in real-time and it is commonly known as NLP. Natural Language Processing Categories are 
  1.  Human Speech Processing
  2. Analysis of Text Data

Applications of Speech Processing in NLP

  1. Voice Assistant like Siri, Cortana, Google Assistant.. etc
  2. Speech recognition based Product to search for eCommerce
  3. Voice-Based Google Search / Bing / Edge

Application of Text Processing in NLP

  1. Sentiment Analysis on Twitter tweets/ Amazon Reviews
  2. Text summarization
  3. Virtual Chatbots for business purpose
  4. Text Tagging

Why we need Sentiment Analysis?

Sentiment Analysis is a widely used Algorithm in Industries to know the feedback on product or service that saves human effort and time. 

Implementing a Powerful Sentiment Analyzer in python 

We are building a Machine Learning Model to Analyze the product on Amazon. Data is Collected for Adidas shoes. 

Requirements for project

  1. Google Colab Notebook 
  2. Download the Dataset 
  3. Natural Language Tool Kit
  4. Numpy and Pandas Libraries
  5. Visualization tool

1. Creating a Notebook in Google Colab

Click on the given link to google colab and create a New Notebook and change the name of your choice. 
Install the following libraries through the pip install method 

2. Reading Review Data and Analysis

Read the Amazon Review.csv data and select the review column as it is the major input data for our Machine Learning Algorithm.

3. Importing Libraries Required for Model

4. Removing Stop-words and Emojies from Reviews

The Review data may contain special symbols and emojis, we have to remove that unwanted information from the data. So we are defining a model that removes emojis from reviews.

5. Advanced Text Cleaning

6. Retrieving Most Pre-trained Positive, Negative, or Neutra Reviews

7. Applying Sentiment Analysis on Reviews

8. Review Classification Based on the threshold

9. Extracting Top Positive, Negative Reviews

10. Performance Analysis

From the figure, we can conclude that most of the reviews are positive.

Google Colab Notebook Link - Sentiment Analysis


How Tech Giants using Sentiment Analysis

Amazon uses sentiment Analysis to auto classify review into positive, negative, or neutral that may help thousands of customers. Google Ad system uses the Sentiment Analysis Algorithm for target audience reaching.

Applications of Sentiment Analysis

  1. Customer Support Feedback Analysis
  2. Product or Service Analysis
  3. Recommendation systems
  4. In Voting for Political Leaders
Thank you for your time !! 🤩🤩
If you want more posts like this, subscribe to our blog and stay tuned. Comment below if you have any queries about code and everything about this one.

Contact us if you want to contribute an Article related to Artificial Intelligence, we welcome all people from all backgrounds... 

Python NLP Machine Learning Sentiment Analysis

Comments