Text Analytics of Social Media Comments Using Sentiment Analysis

Make no mistake, social media is a world of its own. As of July 2020, 3.96 billion users are active across the social media networks and messenger services. That’s more than half the world’s total population of 7.8 billion. Perhaps unsurprisingly, users share billions of content pieces (in the form of tweets, photos, comments, status updates, stories, chat messages, et cetera) every day, contributing to a deluge of data.

People communicate their opinions, grievances and sentiments about products, services and almost everything under the sun on social platforms. It is, therefore, an opportunity for brands to understand their audience, prospects and customers’s pain points, which might be the basis for a new solution or a product feature that can benefit them.

Manually analyzing social media discussions—considering the high volume of data—to sift out key, useful information is overwhelming, costly, likely error-prone, and largely impossible.

Text analytics, which is an automated process of analyzing and extracting meaningful information from text-based data i.e., text extraction solution (structured and unstructured), is one strategy to see through all the noise created on social media and derive actionable insights and conclusions.

Text analytics helps brands discover the following from their social media data:

  • Understand emotion and sentiment
  • Recognize patterns, trending topics, etc.
  • Classify topics and customers pertaining to specific brands.

As there are 3 types of sentiment analysis to evaluate or analyze customer behavior.

Understanding Emotion and Sentiment

Text analytics models are based on artificial intelligence (AI), which uses natural language processing (NLP analytics solution), and can therefore not only read text-based data but also comprehend it.

In the context of social media, text analytics helps identify tonality in text, such as anger, fear, joy, despair, et cetera, expressed via tweets, comments, status updates, stories, chat messages and more.


Identifying Patterns, Trending Topics

Using text analytics, one can discover patterns and themes in user language to derive important and essential feedback.

Using a combination of machine learning and NLP, topics currently generating interest across social platforms can be traced. It helps understand user behavior online and predict what the future trends may be based on the language and terms used.

Classifying Topics and Customers for Specific Brands

Text analytics solutions help brands identify conversations about their products and services. The process is called social listening.

Listening helps brands discover insights and data that are reliable, offer direct feedback and provide a competitive advantage. What’s more, these conversations provide real-time data that’s accurate and actionable. The data can also be visualized for in-depth analysis and to draw inferences from user discussions happening online.

Sentiment Analysis

While text analytics uncovers the hidden meaning of text data, the correlation between words and grammar and syntax, sentiment analysis helps take it a step further.

Also known as opinion mining, sentiment analysis uses NLP and other algorithms to deliver insight into the emotions expressed through written or spoken words and determine whether the tone is positive, neutral, negative or mixed. The technique is capable of deriving feedback from non-text data such as audio, images and video.

Sentiment analysis is easier now with a growing number of customers sharing their opinions and feedback on social media, thereby encouraging brands to engage directly with them. Therefore, brands are able to prevent a PR disaster on social media by flagging complaints and critical requests and attending to them immediately.

However, it doesn’t only have to apply to social media text data. Even product reviews acquired from customers on a brand’s website can also be put through sentiment analysis to gauge customer satisfaction and usability of the product.

For example, if a brand were to automatically analyze 2000 reviews about their product using a sentiment analysis tool, it could reveal if customers are happy with how the product’s priced, if it delivers on promise, its ease of use and so on.

Text analytics software market 2021

Sentiment Analysis of Social Media Data Using Naïve Bayes Classifier

The gathered text data from social platforms must be cleaned and pre-processed, a process which involves removing stop words and stemming.

You must exercise care during the cleaning process, where you do not want to remove multiple words from a tweet or a social media post to ascertain its sentiment.

To understand the sentiment of a social media post or a comment, you may use naive Bayes, a machine learning classification algorithm, as a text classification tool.

Once the data’s cleaned, allocate some of the data for training the model. If a product has 50,000 reviews across platforms (social, website and offline), forty percent of it may be used for training the model.

In the training phase, the classifier is provided with a collection of text. While using the naïve Bayes classifier, the words must be classified as positive, negative or neutral.

The classifier then assigns an independent value to every feature in a dataset to verify the probability that the sum of the values has a specified outcome.

Let’s assume we assign +1 as a score for a positive word and -1 for a negative word. Let’s also imagine every word appears once in a social media post, so each positive and negative word is assigned 1 as a value.

To obtain a positive value, divide the number of positive words by the total number of words in the social media post. Likewise, to attain a negative value, divide the negative words by the total number of words.

Applying the naïve Bayes classifier, the positive value is subtracted from the negative value, with the final value determining the sentiment of the social media post.

If the final value is a positive outcome, the sentiment of the post is positive. If the final value is negative, the sentiment of the post would also be negative.

Here, we have not considered polarizing words, which may make it difficult for the model to understand whether the word is positive or negative.


Sentiment analysis and text analytics help brands track how customers perceive them, conduct contextual performance analysis of their products and gain competitor insights. Key performance indicators don’t always tell the entire story, whereas analytics techniques can help ascertain the cause of a sudden spike in social media follower count and engagement, and even the hidden meaning of text. They help create a powerful social media marketing strategy with customers at the forefront.

Want to transform your business with proper decision-making? Choose teX.Ai, a trustable text analytics solutions provider.

Author: Suhith Kumar
Suhith Kumar is a digital marketer working with Indium Software. Suhith writes and is an active participant in conversations on technology. When he’s not writing, he’s exploring the latest developments in the tech world.

Leave a Reply