The Essential Guide to Sentiment Analysis

Article by Alex Nguyen | August 13, 2019

At the most basic level, sentiment analysis is used to gain understanding of the opinions, emotions and attitudes in a text. Also known as opinion mining or emotion AI, sentiment analysis allows you to determine whether a piece of content is positive, negative or neutral by extracting particular words or phrases. The main purpose of sentiment analysis is to quantify the public opinions toward certain products, events, people or ideas.

A relatively new field of data mining, significant advances in sentiment analysis have been made during the past few years, spurred largely in part by an unprecedented growth in user-generated data. Sentiment analysis also has countless applications across domains, offering insights for big business, politics, psychology and sociology.

This guide is meant to serve as an overview of sentiment analysis: the fundamentals, various types of sentiment classification, how it works, as well as applications and challenges in the field. Let’s jump right in!


An Introduction to Sentiment Analysis


What is a sentiment?

As opposed to objective fact, sentiments are subjective expressions used to describe a person’s feelings towards a particular subject or topic. While ’emotion’ and ‘sentiment’ are used interchangeably by many, there is a fundamental difference between the two concepts. Sentiment implies a more organized and dispositional position towards a target, while emotion describes an involuntary physiological response.

In text, sentiment can be expressed in two different ways: explicitly where an opinion is directly expressed (e.g. “This chocolate is delicious”) and implicitly where the text implies opinion (e.g. “My iPhone broke in a week”). Most sentiment analysis research focuses on explicit sentiment as it is often easier to spot and analyze.

The target of a sentiment can be an object, a concept, an event, a person or just about anything. In the case of movie or product reviews, it’s generally quite easy to spot the topic of the text.

To measure opinions, a sentiment score usually consists of two aspects: polarity and intensity.

  • Sentiment polarity refers to identifying sentiment orientation (from negative to positive).
  • Sentiment intensity describes the strength of sentiment (from low to high).


Why is sentiment analysis important?

Whether you’re conducting market research or making simple everyday decisions, we often look to other people’s opinions before making our own choices. Web-based platforms containing millions of movie ratings, forum threads, social media posts, consumer reports, and restaurant reviews have made access to consumer opinions readily available to anyone on the Internet. This abundance of user-generated content presents a treasure trove of information ripe for text analysis.

A good sentiment analysis engine can automatically transforms raw, unstructured content into structured data about public opinions of products, politics, services, brands and more. This data can in turn be extremely useful for commercial applications, policymakers, social scientists and more. By actively monitoring consumer attitudes and opinions, end users are able to detect subtle shifts in opinions and adapt readily to meet the changing needs of their audience.


Goals of sentiment analysis

Like other complex applications of natural language processing, sentiment analysis can be further simplified into two separate tasks:

  1. Subjectivity classification: Classification of text as objective or subjective.
  2. Polarity classification: Classification of text as positive, negative, or neutral opinion.

This process occurs at many structural levels, from entire documents to individual words. Choosing the appropriate level of sentiment analysis for your use cases greatly enhances the accuracy and coverage of your model. In general, sentiment analysis occurs at three different levels:

  • Document-level: At this level, the goal is to classify an entire document’s sentiment. For example, in the case of customer reviews on ecommerce platforms, the system determines whether the review expresses an overall positive or negative opinion of the product.
  • Sentence-level: A slightly more detailed analysis, the task of sentiment-level sentiment analysis generates a score for each sentence. This provides greater accuracy and coverage over document-level analysis.
  • Entity/aspect level: Rather than looking at language constructs (e.g. paragraphs, sentences), aspect-level sentiment analysis take a more granular approach by looking directly at the opinion itself. At this level, all entities are analyzed and a fine-grained sentiment score is assigned to each.


Sentiment analysis approaches

There are two major approaches to large-scale sentiment analysis:

  • Rule-based approaches: Also known as semantic approaches, these algorithms perform sentiment analysis based on a set of manually defined rules.This is often a top-down approach, as you’re trying to write rules that emulate the knowledge of a domain expert.
  • Automatic approaches: This describes any approach that relies on machine learning techniques to extract, identify or characterize the sentiment of a text. These techniques are often more inductive, finding patterns and regularities and generate structure rather than emulating the mind of an expert.

Each of these approaches requires a considerable human involvement, at least initially. In order for sentiment analysis models to work, human annotators have to first label their perception of the sentiment of individual words or short texts. This sentiment labeling is language-, domain- and even topic-specific.


Managing Your Sentiment Analysis Project

Whether you’re working off pre-labeled sentiment analysis datasets or are looking to build your own data from scratch, here are a few tips for getting your project off the ground.


Establishing Guidelines

Clear and simple instructions are crucial for obtaining high-quality sentiment analysis data. This is true even for the simplest annotation tasks. For sentiment analysis projects in particular, text is annotated by asking respondents to label them as positive, negative, or neutral. While this approach works well for simple expressions of sentiment (e.g. “I love coffee”), complex text samples may leave annotators unsure of how to annotate, resulting in inconsistent labels. Lack of specification leaves annotators in doubt over how to label certain kinds of sentences, such as in the case of sarcasm and irony.

At the start of your project, it’s essential to provide a document that clarifies exactly what you expect, as well as best practices for the annotation process. Annotators will appreciate any further guidance you’re able to provide. One crucial thing to consider is whether you require tags in simple positive / negative / neutral categories, or something more fine-tuned.


Annotation and Quality Controls

At first glance, annotating text for sentiment seems straightforward enough: the annotator should be able to read a text sample and classify it as positive, negative or neutral.

However, determining sentiment expressed in a content sample is not as easy as it seams, and heavily depends on subjective judgment of human annotators. Furthermore, annotators often disagree with each other, and even an individual is not always consistent with themselves. There are several reasons for this, such as the inherent difficulty of the content, personal bias, or simply poor annotation quality.

To help eliminate human error as much as possible, it’s important to have a team of multiple annotators to estimate ground truth data. Especially in the case of sentiment analysis, there is often no right or wrong answer, making it difficult to measure accuracy. Metrics like Cohen’s kappa (κ), Fleiss’ kappa (K), or Krippendorff’s alpha measure inter-annotator agreement as an indicator of quality. These metrics can be used in analysis of the label sets and annotation instructions to improve annotation process and resolve any annotation difficulties.


Text Preprocessing

Consumer opinions are generally expressed in an unstructured, disorganized format. These sources contain varying vocabulary, slang, and context, making manual analysis almost impossible. Transforming text into something an algorithm can digest is a complicated process. At this stage, text analytics and natural language processing are used to identify and extract relevant data for sentiment analysis.

Below are a variety of preprocessing methods commonly used in sentiment analysis:

  • Cleaning: Data irrelevant to the study is identified and removed. This includes, but is not limited to: unwanted punctuation, ASCII code, capitalization and stopwords.
  • Normalization: Text is standardized to create a more uniform sequence. Stemming and lemmatization remove inflectional prefixes and suffixes (e.g. -ed, -ize, -de) from words, generating the root form. For example. runs, running, ran are all forms of ‘run’, which is the lemma of all these words.
  • Tokenization: Larger bodies of texts are broken down into individual words (called ‘tokens’). These words are used as input for other types of analysis or tasks such as parsing.



Growing need for consumer insights will keep sentiment analysis and opinion mining relevant for the foreseeable future. This fast-growing technology has the potential to disrupt a vast range of industries as well as improve the customer experience for all.

Lionbridge AI is a trusted provider of sentiment analysis training data. With nearly a decade of experience creating data for natural language, speech, communication and multilingual projects, we can help you develop your machine learning model with confidence. Our crowd of more than 500,000 pre-tested contributors are located across the globe and available 24/7, providing access to a huge volume of data across all major languages and file types.

The Author
Alex Nguyen

Alex manages content production for Lionbridge’s marketing team. Originally from San Francisco but based in Tokyo, she loves all things culture and design. When not at Lionbridge, she’s likely brushing up on her Japanese, letting loose at indie electronic shows or trying out new ice cream spots in the city.


Sign up to our newsletter for fresh developments from the world of training data. Lionbridge brings you interviews with industry experts, dataset collections and more.