What Is Sentiment Analysis in NLP?

Nov 4, 2020 2:30:00 PM

shutterstock_659394640-1Consider the following fictitious review of the 1999 film The Blair Witch Project:

The premise of the movie is unique: Three University of Maryland film students venture into a heavily wooded area, movie cameras in tow, in search of the mythical Blair Witch. They are never seen again. Years later their footage is found. The resulting first-person viewpoint in the film is a refreshing departure from the typical horror-genre fare. And the 3 young actors are quite convincing in their portrayal of naïve college students in a stressful, frightening situation. However, the characters’ naiveté goes a bit overboard, to the point where they miss common-sense solutions to their troubles and leave the viewer wondering how college students can be such idiots. By the end of the film, you’re rooting for the witch—probably not the response the (real) filmmakers intended.

Anyone reading this passage would know the writer found some positive qualities in the film but was underwhelmed overall.

Quite soon, computers will be able to process this text and reach the same conclusion. The technology that will make this happen is a branch of natural-language processing (NLP) called sentiment analysis.

Sentiment Analysis in a Nutshell

By way of review, NLP is computer technology that processes natural (that is, human-generated) language, both written and spoken, in order to extract meaning. Modern NLP systems rely on artificial intelligence (AI) algorithms to recognize patterns and interpret the words as queries or commands. Alexa and Siri are representative examples, and most search engines have some capability of converting a written question into a search query.

Sentiment analysis is a subset of NLP that seeks to identify the writer’s (or speaker’s) mood, opinion, or feelings towards the topic. It’s a tricky proposition because not every sample of text is going to have obvious positive or negative sentiment behind it.

In the faux movie review above, the writer doesn’t say, “This movie stinks,” or “I kind of liked it.” The opinions are more subtle and include a mixture of positive and negative statements. How could a computer ever figure out the writer’s overall opinion of the film?

The answer is the magic of machine-learning: Training an algorithm with thousands upon thousands of pre-annotated sample passages until it can predict with acceptable accuracy the overall sentiment of each piece.

Why Is Sentiment Analysis Important?

Once upon a time, raw material data analysis was limited to structured data: tidy tables of neat rows and columns. The more numbers those rows and columns contained, the better because computers were (and remain) quite good at calculating numbers. Words, not so much.

Somewhere along the way, we discovered there is immense value locked in unstructured text data. First in books, magazines, newspapers, and other documents, and later in webpages, blogs, and social media. For example, you could learn a great deal about public opinions on any topic by analyzing Twitter messages and Facebook posts.

Social media in particular is abuzz with opinions that politicians, marketers, governments, and more would love to get their hands on. Although less scientific than a controlled professional opinion poll, it’s possible to cast a wider net and get a more complete picture of public opinion using social media as your data source.

To the extent that you can collect and correlate demographic, geographic, or other data with the sentiment, significant insights can be gained. For example:

  • Marketers could gauge the responses to variations in advertising campaigns.
  • Politicians could learn where to focus their campaign efforts.
  • Product manufacturers could get more complete summaries of customers’ product reviews.

Because these sources are text—and unstructured text, at that—computers have a hard time extracting any useful meaning from them. Early attempts at NLP attempted to use word counts and other quantitative measures to estimate sentiment, but the results were mixed at best.

The problem is that human languages have a near-infinite variety of ways to convey opinions, and the differences can be subtle, as noted above. Sometimes changing a single word in a sentence or using the same words in a different order can change the sentiment from positive to negative.

Sometimes the same sentence can be taken in different ways: Is “I recommend this candidate with no qualifications whatsoever,” genuine praise for the candidate, or a snarky way of saying the candidate is unqualified?

The insatiable desire to use machines to extract qualitative sentiment information from the vast troves of available unstructured text has motivated researchers to develop and apply advanced techniques; hence, the AI basis for modern sentiment analysis.

Sentiment Analysis Today

Sentiment analysis is in its infancy, but the results so far are promising.

Researchers have the advantage of the availability of immense amounts of pre-annotated text data in the form of product reviews, which in most cases are conveniently accompanied by star ratings. Review sites such as Yelp and retailers like Amazon and Walmart ask their reviewers to provide 1- to 5-star ratings that summarize their experiences. Sentiment analysis algorithms can, at least in theory, be trained to predict the star ratings on the basis of the sentiments identified in the text.

Most algorithms developed so far perform better when predicting binary (thumbs-up vs. thumbs-down) sentiment. When adding just a third option (such as “neutral”), performance tends to suffer. Quite a bit more research is needed before these algorithms can exhibit anything close to the accuracy and reliability of a human reader.

But the stakes are much too high to even think of giving up. Organizations successful in applying sentiment analysis stand to gain significant competitive advantage. So, research proceeds apace, and it’s probable that sentiment analysis algorithms will soon see greater performance and higher granularity than they are now capable.

Meanwhile, the algorithms we have now are better than nothing. You can gain a great deal of insight with a simple binary positive/negative sentiment value. Twitter posts, for example, are not often accompanied by star ratings, so an algorithm that can summarize the positive vs. negative sentiment of thousands of posts within a few seconds is far more valuable (not to mention faster and more cost-effective) than asking a team of humans to do it.

Unstructured data is the last frontier of data analysis, and humans are producing tons of it every day. With perfected sentiment analysis and other NLP algorithms, humans will have a complete set of keys to unlock the value hidden in our data.


Abdul Dremali

Written by Abdul Dremali

Abdul Dremali is a key content author at AndPlus and a driving force in AndPlus marketing. He was also instrumental in creating the AndPlus Innovation Lab which paved the way for the company’s leadership in Artificial Intelligence, Machine Learning, and Augmented Reality application development.

Get in touch