Sentiment Analysis, Part 1 — A friendly guide to Sentiment Analysis

Jade Moillic
Besedo Engineering Blog
7 min readFeb 21, 2022
Photo by Hybrid on Unsplash

Sentiment Analysis is the process of associating a text with a sentiment. It is also known as Opinion Mining, Sentiment Mining, and Subjectivity Analysis.

Sentiment Analysis is mainly used in the marketing department to understand whether a brand or product is associated with a positive sentiment. It is crucial to notice that it can be used in many fields, just some examples: customer feedback, crisis prevention, even politics. At Besedo, we use Sentiment Analysis for content moderation purposes and explore its usage to provide valuable insights to our clients.

This blog post is the first of a series about Sentiment Analysis. This series is here to guide you through every aspect of creating a model that is able to associate a text to a sentiment. In this blog post, we’ll start with a few nice guidelines for everyone new to Sentiment Analysis. It contains information about the challenges and the different ways to perform Sentiment Analysis. The others will be about finding the best pre-annotated dataset for Sentiment Analysis, annotating, and creating a model.

Alright, let’s go.

Challenges

Sentiment Analysis comes with its baggage of challenges. For example, what sentiment would you associate with these sentences?

“I liked this movie more than the precedent.”

“If the computer were bigger, I would like it more.”

Comparative sentences (e.g., the former) and conditional sentences (e.g., the latter) are hard to analyze, even for humans, so how can we expect a machine to analyze them successfully?

Context is also very important when performing Sentiment Analysis. The sentence “Go read the book” illustrated by Pang & Lee (2008) is associated with a positive sentiment if you refer to a book. Still, it is associated with a negative one if it is about a movie.

It is also known that people use a lot of irony or sarcasm to recognize when people use positive words to express a negative sentiment or vice versa. Plus, wittiness varies a lot between countries due to cultural differences.

“I love being hated by you 🙂”

We also must mention the fun challenges you have to deal with while working on texts: emojis, multiplied letters (“gooooood”), abbreviations, and orthographic mistakes.

Types of Sentiment Analysis

Here, we would like to guide you through the different types of Sentiment Analysis.

If you are new to this field, you should know that there are two major types: “basic” Sentiment Analysis and ABSA (Everything There Is to Know about Sentiment Analysis, s. d.-a). The following parts explain what they are and their differences in more depth.

“Basic” Sentiment Analysis

This is the correct type of Sentiment Analysis if you only seek information about a global sentiment.

“I love summer” — Positive 🙂

“I hate winter” — Negative 😞

But what sentiment would you associate with this text, knowing that you can only choose one?

I love summer but I hate winter” — Positive? Negative?

This example shows that a double sentiment in a text can not be quickly resolved with “basic” Sentiment Analysis.

You also need to make two choices: choose a level and labels.

You can work on a text-level or a sentence-level (Hoang et al., 2019):

  • Text-level: “I love this brand. I think that every product they have is amazing. Nothing bad to say!” — Positive
  • Sentence-level:I love this brand.” — Positive, “I think that every product is amazing” — Positive, “Nothing bad to say!” — Positive

As for the label, it can vary from two to five (or more) labels:

  • Positive and Negative
  • Positive, Neutral, and Negative
  • Scores associated with reviews: 1, 2, 3, 4, 5 or Very Positive, Positive, Neutral, Negative, Very Negative
  • Emotions: Angry, Happy, Sad, etc.

“Basic” Sentiment Analysis is a classification task so that you can use these different methods:

  • Rule-based: create lexicons that associate some words to a sentiment. It can be used with part of speech, syntax rules, and more
  • Artificial Intelligence (AI) based, using Machine/Deep Learning models
Pros and Cons of “basic” Sentiment Analysis

Aspect-Based Sentiment Analysis (ABSA)

ABSA associates terms linked to aspects and identify each aspect’s sentiment. An aspect is defined as the category, the feature, or the subject we are talking about.

If you want details about the subject associated with the sentiment, this is the kind of Sentiment Analysis you want to perform.

ABSA is divided into three sub-tasks: Opinion Target Expression (OTE), Aspect Category Detection (ACD), and Sentiment Polarity (SP). Even if there are three sub-tasks, most researchers only perform OTE and SP.

To illustrate these sub-tasks, let’s have a look at this great example from Do et al. (2019):

Example of Do et al. of an ABSA task
The three sub-tasks of ABSA by Do et al. (2019)
Definition of every ABSA sub-task and the methods you can use
Definition of ABSA’s sub-tasks and methods linked to it

Since the sentiment is linked to an aspect, you will not have to deal with double sentiments in a text as both sentiments will be linked to different aspects. If we reuse the example above and transform it a little:

It has great sushi but terrible service.

Both positive and negative sentiments are represented in the sentence but using ABSA you know that the positive sentiment is associated with the sushi and the negative to the service.

Pros and cons of ABSA
Pros and Cons of ABSA

How to deal with a double sentiment?

How can we separate two parts of a text/sentence, each linked to a different sentiment? The solution to this question in papers is to perform ABSA, but as we saw before, this solution is really complex and requires you to train a model for each dataset you have. After facing this problem, we made some research, and we will illustrate possible solutions by using the following example:

I love this brand. Now we have to admit that their last product is awful. I adore their products, but I really don’t recommend this one.

Perform a sentence-level analysis:

  • I love this brand.” — Positive “Now we have to admit that their last product is awful.” — Negative
  • 👎 : Won’t help if the double sentiment is in the same sentence: “I adore their products, but I really don’t recommend this one.” —?

Cut the sentence in propositions:

  • I adore their products” — Positive “I really don’t recommend this one.” — Negative
  • 👎 : It means you have to perform a sentence-level analysis + cut the sentence into propositions

Perform a multi-label analysis:

  • I adore their products, but I really don’t recommend this one.” — Positive and Negative
  • 👎 : A multi-label analysis is harder

Use a “conflict” label:

  • I adore their products, but I really don’t recommend this one.” — Conflict
  • 👎 : Adding an additional label to already existing ones will probably increase the imbalance of labels

To conclude, every solution has its positive and negative points, and it’s up to you and the kind of study you want to perform what solution you choose.

What should you use?

It is really important that you decide what is the goal of your Sentiment Analysis. The following questions will help you make a choice:

ABSA vs “basic” SA
How to choose between “basic” Sentiment Analysis and ABSA

If we take our case as an example: Sentiment Analysis will be used to provide valuable information we can use in our moderation decision process; it will also help us better understand the data and offer valuable insights to our clients. We need to be really fast in our decisions, and we do not need something really detailed like ABSA yet, so for us, “basic“ Sentiment Analysis was the best option.

For moderation, the negative and positive sentiments are really important, but we also do not want to lose the information when both sentiments are in a given text. We decided to tackle double sentiment using multi-label Sentiment Analysis.

In this blog post, we shared with you our research of different types of Sentiment Analysis (“basic” Sentiment Analysis and ABSA) and how to deal with the double sentiment in a text. We also gave you some guidelines to help you decide the appropriate approach for your study.

We hope our research and this blog post will help you on your conquest of Sentiment Analysis!

Stay tuned for the second blog post of this series: How to choose useful pre-annotated datasets for Sentiment Analysis? 🙂

References

  • Aspect-based Sentiment Analysis — Everything You Wanted to Know! (2020). Medium.
  • Do, H. H., Prasad, P. W. C., Maag, A., & Alsadoon, A. (2019). Deep Learning for Aspect-Based Sentiment Analysis: A Comparative Review. Expert Systems with Applications, 118, 272299.
  • Everything There Is to Know about Sentiment Analysis. (s. d.-b). MonkeyLearn.
  • Hoang, M., Bihorac, O. A., & Rouces, J. (2019). Aspect-Based Sentiment Analysis using BERT. ACL Anthology
  • Hu, M., & Liu, B. (2004a). Mining and summarizing customer reviews. Proceedings of 2004 ACM SIGKDD international conference on Knowledge discovery and data mining — KDD ’04. Published.
  • Guide to Aspect-Based Sentiment Analysis. (2019). MonkeyLearn Blog.
  • Pang, B., & Lee, L. (2008). Opinion mining and sentiment analysis. Foundations and Trends® in Information Retrieval, 1(2), 91–231.

--

--