Insights

Sentiment Analysis of Social Media for Trends Evaluations

Nowadays, people are more connected with each other using smart gadgets and wireless devices whether these are smartphones, tabs or laptops. For sharing the routine experiences, views and sentiments, the messages are broadcast on Twitter and other social media platforms. In current scenario, there exists very less physical interaction among people.

In addition, the availability of users on the digital platforms gives them more time to communicate with each other rather than personal interactions. These scenarios give the experience of inclusion in the digital world and to communicate the views and comments without any hesitation. The digital platforms are providing a safe space to the users to to have the digital experience with carefree behavior.

As per the reports from prominent statistical data analytics portal statista.com, the revenue of Twitter moved to more than 840 million U.S. dollars in the second quarter of the year 2019. NapoleanCat is one of the prominent services for the web analytics and Social media tools. The Research analytics from NapoleanCat reported that there were around 317,500,000 Facebook users in India as on September 2019.

Similar statistics exists throughout the world where the users share their views and experiences with sentiments using social media. These datasets are actively fetched by the market research companies and used for the sentiment analysis for user behavioral mining. With the use of sentiment mining, the diversion and favoritism is analyzed about a specific market product or any other particular item under observation. For example, if Samsung wants to analyze whether to discontinue a specific smartphone, the company fetches data from different social media platforms and then evaluates the current performance of the specific smartphone under observation. If users give overall good feedback and reviews about the smartphone, then company may leave the idea to discontinue the gadget.

There are many tools and technologies available for sentiment mining and real time data analytics. In general, the Application Programming Interfaces (APIs) are provided by different social media platforms so that the research groups and analytics organizations can fetch the users’ tweets and reviews. This process is known as Web Scraping and is available in many programming languages including Python, Java, Ruby, PHP.

Following is the example to extract the real time tweets from Twitter using Python Script. The script can fetch real time data from all over the Twitter social media on who all are sending tweets about a specific keyword for example, 'Samsung Note X’.

from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
consumerkey = 'XXXXXXXXXXXXXXXXXX'
consumersecret = 'XXXXXXXXXXXXXXXXXX'
accesstoken = 'XXXXXXXXXXXXXXXXXX'
accesssecret = 'XXXXXXXXXXXXXXXXXX'
 class FetchTweetListener(StreamListener):
    def on_data(self, data):
        print data
        return True
     def on_error(self, status):
        print status
auth = OAuthHandler(consumerkey, consumersecret)
auth.set_access_token(accesstoken, accesssecret)
stream = Stream(auth, FetchTweetListener())
stream.filter(track=['Samsung Note X'])

After executing the script on Anaconda Data Science Platform having Python, the tweets can be fetched in Java Script Object Notation (JSON) format. This JSON file is parsed to CSV so that the data analytics can be done and trends about the particular product can be evaluated about the popularity.

In addition to Anaconda Platform with Python, the use of Natural Language Toolkit (NLTK) (https://www.nltk.org) can be integrated. The NLTK toolkit of Stanford University provides the functions and programming APIs for in-depth tweets analysis to understand the positive, negative or neutral emotions. This NLTK library provides the repository of all words in English Language which are used on social media platforms for deep analytics of emotions in the tweets or timelines.

There are other platforms and libraries available for recommendation system and investigation of trends in the digital social media platforms including the following:

  • Apache PredictionIO https://predictionio.apache.org/
  • Recalot http://recalot.com/
  • Lenskit https://lenskit.org/
  • Recombee https://www.recombee.com/
  • Crab http://muricoca.github.io/crab/

With the use of these platforms and libraries, the future predictions on the market research can be done. These libraries assist the business analysts and data scientists to fetch the real time data from the Internet and to present the predictions for multiple business applications.