Sentiment Analysis of Social Media

Tools and Features of Sentiment Analysis


We live in a world where the globe is connected and communication made easy with the click of a button.

In this social age, the evolution of the World Wide Web (www), characterized by the advancement of smartphones and semantic technology, has redefined social media as a retail platform and an indispensable marketing tool.

What is Social Media Marketing?

Social media marketing (SMM) is a form of digital marketing that involves sharing content on social media platforms in an attempt to actualize a firm’s branding, sales, and web traffic goals. Social media has become essential to helping brands connect to a wider range of customers, establish brand presence, and increase sales both in-store and online.

Considering the size of this new virtual market, it comes as no surprise that marketers would choose to use social media to increase brand awareness.

Brand Awareness

Brand awareness refers to extent at which customers are able to identify or recognize a brand’s product by its name. This is important because the higher the level of brand awareness the higher the sales of the brand’s products or services are likely to be. Brand awareness also increases market share, and can be a useful tactic when trying to promoting new products or trying to revive older brands.

Example: Coca Cola

Despite the soft drink industry having many brands offering similar products, Coca Cola has remained the leading soda brand. Coca Cola’s success is mainly attributed to its strong brand equity, global presence in more than 200 countries, and its large customer base.

Similarly important to consider besides creating brand awareness is gaining and retaining loyal customers. To maintain relevance, brands must first understand their customers’ thoughts and sentiments. However, this requires the analysis of large amounts of unstructured data created from customer conversations on different social media platforms. This is where sentiment analysis comes in handy.

What is Sentiment Analysis?

Also known as opinion mining, sentiment analysis is a text analysis technique that uses natural language processing (NPL) and machine learning algorithms to perform large scale analysis of customer conversations on social media (i.e., social media likes and/or comments, customer reviews, and shares and/or retweets) in real time. In this way, brands are able to detect social mentions and gauge the customer’s sentiments about a particular product or service and give quick and accurate responses. Sentiment analysis also allows businesses to monitor competitor presence. Based on what customers have to say about a particular product or service, competitors are able to compare their products and determine what to improve on or figure out where their competitive advantage lies.

Thankfully, many sentiment analysis tools are open-source which makes them cost effective, however, using them often requires experience in machine learning and natural language processing.

Open source tools include:

Instead, marketers can opt for software as a service (SaaS) sentiment analysis tools that are ready-to-use. Some popular SaaS tools include:

How Does Sentiment Analysis Work?

Sentiment Analysis can be categorized into three models:

  1. Polarity of Opinion

2. Personal Feelings

3. Intentions/Objectives

Polarity of opinions involves categorizing customer conversations into either positive, negative, or neutral. Alternatively, marketers can carry out a fine-grained sentiment analysis which allows them to sort data at scale. In this way customer conversations can be categorized on a scale of very positive, positive, neutral, negative, to very negative. This type of model is commonly applied to polls, surveys and reviews.

5 stars means very positive while 1 star means very negative

Personal feelings can be measured using emotion detection. For this type of model, specific emotions such as anger or happiness can be detected from text. This works by using a word list that is defined by emotions (e.g., good to mean positive emotions or bad to mean negative emotions). This however can be misinterpreted as certain words associated with negative emotions may also be used to denote happiness or satisfaction (e.g., sick, wicked, ill and mad can be used to as praise e.g., ‘That band has mad skills’). In this case, advanced machine learning algorithms are used which can detect more complex sentiments such as irony and sarcasm.

This leads us to address the main challenges associated with sentiment analysis. Although more accurate sentiment classifiers exist, machines still find it difficult to analyze sentiment based on tone and context or differentiate sentiment based on objective text versus subjective text.

Intentions can be analyzed using aspect-based sentiment analysis. This involves a combination of both opinion polarity and emotion detection.

For example in the text: “ The phone’s front camera could be better ”, the aspect-based model can identify the negative opinion being expressed by the customer about the camera feature.

Different algorithms can be implemented in sentiment analysis models depending on the amount of data that needs to be analyzed and the accuracy required of the model.

Sentiment Analysis Algorithms

There are three types of algorithms that can be applied to sentiment analysis models:

  1. Rule based
  2. Automatic
  3. Hybrid

Rule based algorithms use manually crafted rules developed in computational linguistics such as lexicons (i.e., list of words and expressions)to help identify subjectivity or polarity of opinion. The system categorizes words into either negative or positive and counts the number of times each category of words appears in a text. The sentiment is positive if the appearance of positive words exceeds that of negative words, and negative if vice versa. If the appearance of both negative and positive words are similar, then the system returns a neutral sentiment.

Nevertheless, this algorithm can still be considered naive because it doesn’t take into account the combination of words in a sequence. To remedy this, new rules can be added to support new expressions and vocabulary but requires regular maintenance.

This system relies on machine learning techniques where a classifier is fed a text and returns either a positive, negative, or neutral category.

Source: MonkeyLearn
Source: MonkeyLearn
Source: MonkeyLearn

The model is trained to associate text (input)to corresponding output (tag)based on a sample of texts. The text is transferred into a feature vector and a model is created from a pair of feature vectors and tags (i.e., positive, negative, neutral).

The main approach to extracting features from text to use in modeling is bag-of-words or bag-of-ngrams. This approach describes the occurrence of words and involves two things:

  1. A vocabulary of known words
  2. A measure of the presence of words

This approach ignores the order and structure of words because it assumes that the meaning of text can be learnt from content alone. The complexity of this approach can be determined by how we define the vocabulary of known words and how we score the occurrence of these known words.

To learn more about classification algorithms, it might be useful to read more on statistical model classifiers such as Naive Bayes, Linear Regression, Support Vector Machines, and Deep Learning.

This system involves the combined use of rule based and automatic algorithms. This creates more accurate results.

Social Media and Brand Monitoring

Sentiment analysis allows brands to get instant feedback about market campaigns, new products, or services. Keeping track of real time sentiments from customers is important. This is because customer conversations are likely to include either negative mentions or praise. Whichever the case, it is important for brands to respond to customers’ sentiments as quickly as possible before things spiral out of control.

In my opinion, the biggest risk involving the use of social media marketing is a tarnished brand name.

Example: H&M, Nike

On 25 March, statements by Nike and H&M voicing their concerns about caims of suspected forced labor in the cotton-growing Xinjiang Autonomous Region made rounds on popular Chinese microblog Weibo sparking heated discussions by netizens. In a matter of hours the issue had become a trending topic and the situation had escalated from simple online discussions showing support for Xinjiang cotton to a handful of celebrities terminating their contracts with many of the western luxury brands affiliated with the matter. According to BBC, some of the brands’ online shops have since been blocked and their physical store locations erased from digital maps.

What is the lesson learnt?

Although creating brand awareness is important, it is equally important for brands and businesses to be mindful of not only the volume of online mentions but also the context in which discussions about a brand or its products are taking place (what are customers saying about your brand?)


Social media is an indispensable and efficient tool for businesses looking to increase their customer base and expand their brand presence online. Using sentiment analysis on social media is a creative yet vital marketing strategy for businesses seeking to better understand their customers and gain marketplace insights. However, like with other marketing strategies, social media marketing has its challenges which business should carefully consider and be ready to tackle.

An Economist curious about world of Data Science

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store