Our everyday activities are dominated by decision making for which we often seek or are influenced by opinions of others. When we decide to buy a new TV set or a new car, we may consult family, friends, reviews on blogs or check out user comments on e-commerce websites.
Whereas 100 years ago, the number of products on offer was relatively limited and it was often enough to rely on opinions of family members or acquaintances, this is no longer true today when, on Amazon US alone, there are more than 600 million products readily available for buying, just a click away.
Thankfully, the surge in the number of products and services available was accompanied by an even steeper growth in online opinions on them, providing helpful guidance for our purchasing decisions.
As the opinions of others drive our purchases and thereby directly impact sales of companies, the gathering and analysis of these opinions is extremely valuable for businesses.
Companies extract opinions from product/service review sites, social media posts, surveys and other opinion channels. It allows them to better understand pros and cons of their products from view of customers, manage their brand reputation, understand users intents and emotional triggers, monitor their agents, use social media monitoring to proactively respond to client’s complaints and for other purposes.
Online opinions are however not solely confined to commerce domain, they also importantly impact our behaviours and our beliefs, which makes them interesting for non-commerce entities as well, e.g. for political or community organizations.
This widespread interest in our opinions along with abundant and easily available information about them in digital, but mostly unstructured form has led to the rise of a new field called Sentiment Analysis or Opinion Mining.
Definition of sentiment analysis
The main goal of sentiment analysis is to computationally identify opinions in texts, determine the target of each opinion and identify the sentiment they express toward the target: positive, negative or neutral.
Target of the opinion can either be an entity, e.g. restaurant or some aspect of the entity, e.g. food in the restaurant.
Consider the following sentence:
“The battery life of this phone is very long”.
The sentence expresses an opinion about an aspect (“battery life”) of an entity (“phone”). Sentiment is represented with the words “very long” and is positive in this context.
Following Bing Lu, we can introduce a more formal definition of an opinion:
Opinion is a set (e,a,s,h,t), where e is an entity, a is aspect of entity e, s is the sentiment on aspect a of entity e, h is the opinion holder and t denotes the time when holder h expressed this opinion.
Most type of sentiment analysis focus on sentiment polarities, which can be positive, negative, neutral or in some cases divided in more categories, e.g. 1 star – very negative, 2 stars – negative, 3 stars – neutral, 4 – positive and 5 – very positive.
Sentiment values are in most cases categorical, known as polarities and are denoted as positive, negative and neutral.
Based on definition of opinion, we can define the main goal of the sentiment analysis:
The objective of sentiment analysis is to determine all opinions (e,a,s,h,t) in a given text.
For illustration, let us consider the following comment:
“The food that was served in our last visit to the restaurant “Bass” was much better, however, the service has been below average”. Lucy, November 2011.
Sentiment analysis of this comment would extract two opinions, which can be represented using form of (e,a,s,h,t) used above as:
(“Bass”, “food”, “positive”, Lucy, November 2011)
(“Bass”, “service”, “negative”, Lucy, November 2011)
Types of Sentiment analysis
Depending on the text unit of analysis, we can distinguish between sentiment analysis of documents, sentences and aspects.
When trying to determine the sentiment of the whole document we usually assume the document is only about one topic/entity. Document can e.g. be a quarterly earnings report about a single company, and we could be interested in the sentiment of this document as an input to a quantitative model for trading the stock of this company.
Alternatively, we can be interested in sentiment on the level of sentences. Again, it is desirable that the sentence expresses an opinion about a single entity or topic.
The most detailed sentiment analysis is the one which was described in our general definition above and is interested in opinions about individual aspects of various entities, such as the screen quality on a mobile phone. E-commerce companies are often interested in this aspect based sentiment analysis as it allows them to extract insights about specific features of their products and services as well as monitor their evolution through time.
Now that we have acquainted ourselves with the definition of opinions and examined concrete examples, we can consider the main tasks of the sentiment analysis or opinion mining which naturally follow from the definition of opinion.
Main tasks in opinion mining
Although sentiment analysis sometimes denotes just determining the sentiment of a given sentence or document, the general sentiment analysis or opinion mining is composed of more steps:
- identification of entities. It should be noted that the same entity can be described with different entity expressions. Laptop, computer and machine can e.g. all refer to the same entity within given context,
- aspect extraction,
- identification of opinion holders,
- determination of time when opinion was expressed,
- sentiment classification of opinion on aspect of entity,
- collection of all opinions in given document.
In our further discussion and in the study considered below we will focus on the 5th task – sentiment classification of opinions.
Figure 1: Sentiment Analysis and Opinion Mining
Sentiment classification methods
We generally distinguish between three groups of methods for sentiment classification:
- lexicon based approach
- machine learning based methods
- hybrid approaches
To assess sentiment of opinions we generally rely on so-called sentiment or opinion words. These are words that most clearly express positive and negative sentiment. Examples of opinion words are good, great, bad, excellent, sad, superb. Words like these form a sentiment lexicon which is instrumental for lexicon-based approach to sentiment classification.
Lexicon-based approaches that rely mainly on opinion words have several drawbacks. One is the limited size of sentiment lexicons, often just a few thousand words. Liu lexicon e.g. consists of around 6,800 words, divided in around 2,000 positive words/phrases and 4,800 negative words/phrases.
Another drawback of lexicon based methods is that a sentence may be composed from sentiment words but does not express any opinion, e.g. a question »Excuse me, which of these Samsung televisions have good picture quality? «. On the other extreme are sentences that express opinions, but do not contain any sentiment words, e.g. »this computer is heating up a lot«.
Sentiment classification with machine learning
Early pioneers of applying machine learning to sentiment classification were Pang and Lee, which used Naïve Bayes (NB), Maximum Entropy (ME) and Support Vector Machines (SVM) for binary sentiment classification of movie reviews. They achieved the highest accuracy of 82.9% with SVM and unigrams. Interestingly, using bigrams resulted in a model of lower accuracy. They also observed a better performance by accounting only for feature presence, not feature frequency.
The most common machine learning methods for Sentiment Classification are:
- Naïve Bayes classification
- Maximum Entropy
- Support Vector Machines
- Decision Tree classification
- Deep learning
In the second part of our article series on Sentiment Analysis and Opinion Mining, we will build and train several machine learning models for sentiment classification of tweets.