Skip to main content

Introduction to Sentiment Analysis

How Sentiment Analysis using NLP helps you understand Customers better

Natural Language Processing is the subfield of Machine Learning that studies how humans can teach computers to understand our spoken words and written texts. Humans have an almost immediate understanding of written and spoken language. Reading the word dog will probably make you think of a fluffy animal, while hearing the word rain will make you think of an umbrella or a waterproof overcoat. These instinctive associations that we make between words, images and concepts are easier for humans based on years of formal education and numerous interactions with other people. The same process is tedious for a machine. Hence, a computer will not necessarily be able to associate the word cloudy to “the possibility of rain” or to understand that the words King and Queen are of similar roles, but are of distinctive genders.

Using and understanding language is considered as one of the most complex and human-proper tasks a machine can perform.  Hence, how can one know how to define whether or not a machine has Artificial Intelligence faculties? Alan Turing was one of the first to ask this question which led to the following test: If the said machine has the capability to trick a human into believing it converse with another human then the latter is true. This test is known as the famous Turing Test [1].

Fig.1 Computer (A) succeeds the Turing test if it convinces human (C) that he converses with another human.

How can NLP come in handy?

Since communicating is renowned as a fundamental component of our daily lives, the application of NLP processes becomes extremely helpful and be so, in a wide range of situations. Below, is a summary of fields where NLP can be a valuable ally:

  • Topic Categorization

Proper text classification is a crucial requirement to accurate online research. With the help of NLP, one is now able to topic-search based on a simple key-word. Moreover, NLP’s topic classification method is also useful in large firms’ customer service department. Indeed, by automatically being able to grasp the nature of the customer’s issue the call can be redirected towards the appropriate HR employee hence reducing usual service time which thereby leads to an increased customer’s satisfaction.

  • Machine Translator

A thoroughly-built translation tool requires not only the  knowledge in both languages’ entire vocabulary, but also needs to have a strong understanding of every surrounding subtleties of said vocabulary such as idioms, ways of saying and all the existing sentence contexts.

  • Text Summarization

The large amount of information shared in newspaper articles and scientific papers is more than never overwhelming to process that is for any individual or organization. Hence to facilitate the task, NLP methods such as topic modelling, sentence similarity score and frequency analysis grant the possibility for text shortening while retaining the most important information.  The produced summaries therefore dramatically improves the user’s learning rate by particularly allowing quicker grasping of new sources’ content and hence limiting the need to  read the full version to an only interest for more details. 

  • Sentence completion

The ability to complete sentences is essential to infer the meaning of unclear words in a written text or a spoken message. If we read the sentence “I went to the ___ to buy bread” we know that the word supermarket is a good fit to fill the blank and that “bakery is an even better one. Thanks to the large online available text dataset, it is possible to train a Neural Network to decide which word is a better fit in a certain context. An interesting result of these training sessions is that machines develop a mathematical representation for words which can be used to find the semantic similarity between the words and the sentences in which they are used.

  • Dialogue Agents

One of the most advanced uses of Natural Language Processing and Understanding that has been done so far is the digital personal assistant, like Apple’s Siri or Amazon’s Alexa. These “assistants” must be able to understand the directives given by their users and act accordingly.

In this article, we are going to focus on the commercial use cases of NLP and how NLP methods are used to analyze the general sentiment induced from a written text.

Use case of sentiment analysis

  • Customer Sentiment Evolution

Customers’ opinion of a brand or a company in general is continuously changing but nevertheless, it remains essential to monitor its evolution through time. Thus, discovery of negative trends in clients’ sentiment is key and the best starting point to reverse it.

  • Operations Analysis

There are multiple aspects which contribute to the user's opinion of a business. Even if the data is partially structured (like in starred google reviews), it is hard to identify which factor precisely contributed to the overall score. Pairing sentiment analysis and topic recognition allows us to extract the purpose behind each review and define a clearer user’s opinion.

  • Segment Analysis

An accurate understanding of which customer’s segment is a supporter or a detractor of a brand consists of an essential input to ensure a successful marketing campaign. This information allows the marketing department to better target dissatisfied customers.

  • Point of Sale Review

This use case is particularly interesting for large companies with a large number of branches and franchises. Granular analysis of customers’ opinion in different geographical areas is necessary to identify underperforming Sales Points that requires particular attention.

Use case of sentiment analysis

  • Customer Sentiment Evolution

Customers’ opinion of a brand or a company in general is continuously changing but nevertheless, it remains essential to monitor its evolution through time. Thus, discovery of negative trends in clients’ sentiment is key and the best starting point to reverse it.

  • Operations Analysis

There are multiple aspects which contribute to the user's opinion of a business. Even if the data is partially structured (like in starred google reviews), it is hard to identify which factor precisely contributed to the overall score. Pairing sentiment analysis and topic recognition allows us to extract the purpose behind each review and define a clearer user’s opinion.

  • Segment Analysis

An accurate understanding of which customer’s segment is a supporter or a detractor of a brand consists of an essential input to ensure a successful marketing campaign. This information allows the marketing department to better target dissatisfied customers.

  • Point of Sale Review

This use case is particularly interesting for large companies with a large number of branches and franchises. Granular analysis of customers’ opinion in different geographical areas is necessary to identify underperforming Sales Points that requires particular attention.

What is the process behind sentiment analysis?

There are two conceptual frameworks to the approach of sentiment analysis:

  • Rule-based approach
  • Machine Learning or Statistical approach

Rule-based approach attempts to assign relative scores to an entire vocabulary composed of frequent words and add rules according to the type of situation at-hand.

As an example, one knows that the word bad has a negative connotation,nice, a positive one, that to describe a meal terrible is worse than bad and that to describe the weather wonderful is significantly better perceived than nice.  All of which results in wonderful having a higher positive score than good, while terrible having a lower negative score than bad. These values are usually assigned once the surveys are completed, by multiple users and by calculating the average of each of their word’ scores.

Simply knowing the words’ polarity within a text is not sufficient to infer its sentiment. Consider the following two examples, both containing the same adjective, which taken alone has a positive tone.

  • We had a good meal
  • I do not think this is a good restaurant

If we attribute a polarity score solely based on the presence of adjectives with a positive connotation, both these sentences would have the same score, which clearly is incorrect. Hence, adding a rule to our scoring system is mandatory to invert the polarity of a closer to negation word. There are more rules that can be added to the  list. For example:

  • The polarity of a sentence will increase if it contains capitalized words (GOOD JOB transmits a more positive message than good job does)
  • Exclamation mark increases the polarity (terrible meal!!! transmits a more negative message than terrible meal. does)
  • If there is a word positioned after the word but it will carry out more weight than the ones before does

The combination of the words’ score and their tonality level of negation, it is possible to induce a polarity score, usually normalized within -1 (totally negative) and 1 (really positive). Nevertheless, countless exceptions exist for each setted rule hence many special cases arise requiring construction of a custom line of code (or of a custom statement) . The latter implies that it is almost impossible to achieve perfect accuracy using this type of classifiers. However, performance can be improved everytime we encounter a new unique case while building a new specific rule. Even though the process of both gathering words’ score and implementing new specific rules can be of tedious and time-consuming nature, the rapidity of this classifier and its allowance to a continuous access to results, is in the end beneficial for its users by giving them the possibility to rank the reviews or comments in the dataset.

The opposite approach to this classification problem, the Machine Learning or Statistical Approach, relies on the statistical study of the text similarities and differences for each category. The main assumption behind this method is that “You shall know a word by the company it keeps”, meaning that a similar text will contain a similar set of words [2].

“You shall know a word by the company it keeps.” - J.R. Firth, English Linguist

Since this approach uses a Machine Learning algorithm, it requires a large labelled input dataset to achieve sufficient accuracy. With a sufficient amount of labelled data, it is possible to train a classifier to separate each new sentence in a discrete class of label, such as “positive”,”neutral” and ”negative”.  The advantage of this approach is that it is able to partially handle the context within the dataset. For example, the word “soft” has a positive value when it is associated with a pet, but will be given a negative value when used to describe the performance of an athlete. Using a training dataset within the same context of the text we wish to analyze will reduce the contextual error caused by the interpretation of certain words.

A use case by Sia Partners

Convinced that open data could bring significant added value to customer care, our Datascience team has developed an AI solution that capitalizes on online customer reviews to allow a live evaluation of brands, services and products offered at different levels: general, product, service, staff, organization, operations, etc.; as well as a comparison of their performance. It includes:

  • Overall multi-sources analysis and detailed analysis of satisfaction and dissatisfaction by theme thanks to sentiment analysis and topic classification
  • Comparison of networks or institutions in different geographical areas
  • Detection of weak signals and specific intentions
  • “Reply to notifications” available directly from the interface
  • Diagnosis and optimization of local presence

This tool not only allows a precise and real-time measurement of customer satisfaction on themes monitored by the company, but also to highlight weak signals on themes not initially monitored by the company. This functionality is part of our AI Consulting for Good project for the detection of ethical risks and non CSR attitude of employees and companies.

Fig 2. Presentation of the Social Listening Product

In an upcoming article about NLP we will explain how we use Word vectorization for sentiment analysis.

 

Contact : dmartineau@sia-partners.com