Have you ever wondered if the feedbacks, comments provided by people to various companies are worth it or they just take your feedbacks as they are obliged to do it?
Actually you are mistaken these feedbacks play a very crucial role for the services provided to you. They make use of your reviews and opinions to provide better facilities to you. This is the place where Sentiment Analysis comes into play which is an application of Text Mining.
Text mining is about obtaining meaningful insights from huge amount of text. These insights actually help the companies to grow their business and provide satisfactory services to the customer.
Sentiment analysis is an information extraction task which checks whether the writer’s feelings expressed in a text is Positive or Negative.
There are many other examples where your reviews and opinions do matter. Many companies such as Credit Vidya, Hello Soda determine risk profile for the applicant and predict if they are eligible for loan or not. They create risk profile on the basis of words the applicant has used on various social sites.
We get this text from various sources such as
- Social media like your Facebook account, Twitter account or Quora.
- Government sources (You can visit the link)
- Company database and many others
We will now look at an example of Twitter Sentiment Analysis
Step1:-To perform Twitter Sentiment Analysis you need to install all the required libraries. If anyone of them is missing install it using Install.packages (“package name”).
Note: – I have used 3.4 version of Rstudio and I suggest you to use that version as it will be more compatible with the above mentioned libraries.
Step2:- Next you need to have twitter API access and you can do it using developer.twitter.com if you have a twitter account already setup with them.
Step3:- Now you need to perform authorization using the OAuth (it is the industry-standard protocol for authorization). You need copy the exact same command.
Step4:- You can now extract the tweets for any topic about which you want to perform sentiment analysis. I have taken for “bit coin” which is a very trending topic now.
Here we are having following arguments:-
n- It specifies the number of tweets you want to extract.
Lang- It denotes the language in which you want to extract the tweets.
Since- It mentions the starting date for the tweets.
Step5:- Now we have our tweets and now we will convert them to vectors.
Step6:- We can further clean the data if we want and remove other unnecessary things. Now we will make the wordcloud by the following command:-
This is how our word cloud will look like:-
Step7:- Now we will perform the Sentiment Analysis and you will be using the following commands to do it.
Step8:- Now we will plot our graph.
This is how our plot looks like:-
You can watch the video to understand it better.