Analysis of the Dataset
Let’s check out that how many counts are there for positive and negative sentiments.
Python3
data[ "label" ].value_counts() |
Output :
1 5726 0 4250
To have the better picture of the importance of the words let’s create the Wordcloud of all the words with label = 1 i.e. positive
Python3
consolidated = ' ' .join( word for word in data[ 'review' ][data[ 'label' ] = = 1 ].astype( str )) wordCloud = WordCloud(width = 1600 , height = 800 , random_state = 21 , max_font_size = 110 ) plt.figure(figsize = ( 15 , 10 )) plt.imshow(wordCloud.generate(consolidated), interpolation = 'bilinear' ) plt.axis( 'off' ) plt.show() |
Output :
Now it’s clear that the words like good, nice, product have high frequency in positive review, which satisfies our assumptions.
Let’s create the vectors.
Flipkart Reviews Sentiment Analysis using Python
This article is based on the analysis of the reviews and ratings user gives on Flipkart to make others aware of their experience and moreover about the quality of the product and brand. So, by analyzing that data we can tell the users a lot about the products and also the ways to enhance the quality of the product.
Today we will be using Machine Learning to analyze that data and make it more efficient to understand and prediction ready.
Our task is to predict whether the review given is positive or negative.
Before starting the code, download the dataset by clicking this link.