What is Sentiment Analysis?

“No takers for ‘Takers’”

I had already received three posts slamming the new movie ‘Takers’ on Facebook. I had determinedly ignored them and planned to watch the movie this weekend. However, this last post was from someone who I considered a movie buff with taste similar to mine. The decision was made. Instead, I watched South Africa massacre India in the first test.  ‘Takers’ could not have been much worse.

Information now-a-days is being created at a frightening pace. Over 30 billion pieces of content are shared every month of Facebook. There are 55 million tweets  a day and hundreds of millions of blogs and forums being read by billions of people. Personal opinions abound in the shape of reviews, ratings and recommendations.

This is a gold mine of information for analysts and businesses who want to feel the pulse of the collective consciousness of the world wide web.

  • What do customers think of my product?
  • Are they happy with the services?
  • How do my policies or external events impact my customers’ perception of me?
  • What do customers like about my competitors?

Online opinion is a powerful force that can make or break a product in the market place. Yet many companies struggle to make sense of this glut of bouquets and brick-bats that comes their way on the web. Is there a way to make sense of this jungle of information, find meaningful patterns and make fact-based decisions?

Sentiment analysis is a powerful, emerging field that attempts to analyze and measure human emotions and convert it into hard facts. On the web, it helps businesses monitor news articles, online forums and social networking sites for trends in opinions about their products and services or topics in the news.

“Stub hub” an online ticketing company used such monitoring tools to identify an upsurge of negative blog sentiment against the company after its decision to not refund tickets for a particular game. The company quickly went into damage control mode by offering discounts and credits to affected customers.

The US home land security has been working with a consortium of universities over the last 4 years to develop a software that would let the government monitor negative opinions of the US or its leaders in newspapers and other publications overseas.

Large companies like Wal-Mart use sentiment analysis to observe opinions about themselves as well as specific issues around them.

What is sentiment analysis python?

Sentiment analysis python is a methodology for evaluating text to detect hidden sentiments. This is enabled through the use of machine learning and NLP. Sentiment analysis examines the emotions represented in a piece of writing.

Why is sentiment analysis important?

Sentiment analysis python solves several business problems:

  • It helps to predict customer behavior for a particular product.
  • It can help to test the adaptability of a product.
  • Automates the task of customer preference reports.
  • It can easily automate the process of determining how well a movie run by analyzing the sentiments behind the movie’s reviews from several platforms.

How does sentiment analysis work?

At a basic level sentiment analysis works by classifying the polarity of a given text, either in part or in full. The simplest algorithms work by scanning keywords to categorize a statement as negative or positive, based on a simple binary analysis. Example – “enjoyed” is good, “miserable” is bad.

sentiment analysisHowever, this is just the first step. Businesses have realized that when opinions are aplenty, not all are equally important. Some opinions carry more weight than others. A negative review by Lady Gaga on Twitter will have a much greater impact on a restaurant than a tweet by an ordinary person. Sentiment analysis tools now allow users to generate ‘influence scores’ to identify people, blogs, forums etc. that are important to their company or industry.

A restaurant could leverage sentiment analysis to find people on twitter who have the highest percentage of tweets related to restaurants or that particular restaurant. Amongst these, a twitterer with higher number of followers would be graded higher on influence and then re-tweets would measure level of engagement from the audience. In this way, a business could identify opinion-makers that are relevant to them and assign them higher weights to calculate a more accurate indicator of sentiment.

Differentiate between rule based approach and machine based approach

What is a rule based process?

What is a Machine-based process?

The machine follows rules or instructions given by the developer. It is also called lexicon based sentiment analysis. The machine itself understands data, identifies patterns and makes decisions. 



Once trained, the machine ignores any modifications made to the original database. Assists in acquiring new information.
lexicon-based sentiment analysis example-Virtual Assistant. Machine based sentiment analysis example– Image recognition

Installation and Authentication of Twitter Sentiment Analysis using Python:

  • Tweepy is a Python client for Twitter’s official API.
  • Install it by running the pip command:

pip install tweepy

  • TextBlob: text blob is a Python package that allows you to handle textual data.
  • Install it by running the pip command:

pip install textblob

  • In addition, install certain NLTK corpora using the command: 

python -m textblob.download_corpora

  • (Corpora is a big and well-organized collection of texts.)


To retrieve tweets using Twitter API, one must first register an App with their Twitter account. Follow these steps:

  • Open this link and click the ‘Create New App’ option.
  • Fill out the application form. The callback URL field can be left blank.
  • You will be routed to the page after the app has been created.
  • Navigate to the ‘Keys and Access Tokens tab.
  • ‘Consumer Key,’ ‘Access Token,’ ‘Consumer Secret,’ and ‘Access Token Secret’ should all be copied.

Some interesting news and articles on this topic.

Related articles:

Interested in learning about other Analytics and Big Data tools and techniques? Check our IIM Indore-certified Integrated Program In Business Analytics today!

Related Articles

Please wait while your application is being created.
Request Callback