Twitter allows businesses to engage personally with consumers. However, there’s so much data on Twitter that it can be hard for brands to prioritize mentions that could harm their business.
That's why sentiment analysis, a tool that automatically monitors emotions in conversations on social media platforms, has become a key instrument in social media marketing strategies.
Start analyzing sentiments on Twitter
Carefully listening to voice of the customer on Twitter using sentiment analysis allows companies to understand their audience, keep on top of what’s being said about their brand – and their competitors – and discover new trends in the industry.
In this guide, learn how you can use sentiment analysis tools to listen to your customers on Twitter, and follow our tutorial on how to perform sentiment analysis in just a few simple steps.
Let’s get started.
Sentiment analysis is the automated process of identifying and classifying subjective information in text data. This might be an opinion, a judgment, or a feeling about a particular topic or product feature.
The most common type of sentiment analysis is ‘polarity detection’ and involves classifying statements as positive, negative or neutral. A polarity sentiment analysis model, for example, automatically tags this tweet as positive:
Connect sentiment analysis tools directly to your social platforms , so you can monitor your tweets as and when they come in, 24/7, and get up-to-the-minute insights from your social mentions.
Performing sentiment analysis on Twitter data involves five steps:
In this section, we’ll explain each of these stages and provide tools for both coders and non-coders so you can get started with sentiment analysis right away.
It’s important that your Twitter data is representative of what you're trying to find out because you’ll use it to:
You should also consider the type of tweets you want to analyze:
Current Tweets: useful to track keywords or hashtags in real-time.
Historical Tweets: useful to compare sentiments over different periods.
Now, you’re probably wondering how to extract data from Twitter if you don’t already have it saved in your help desk or in an Excel file. There are different ways to do this. Let’s take a closer look at some of the options:
Zapier is a platform that enables different teams (marketing, HR, customer support, product, etc) to connect the apps they use so that they can work together. It’s excellent for non-technical users since you don’t need to write a single line of code to gather tweets.
To create an automated workflow on Zapier (a Zap), just choose one app as the Trigger(this will be the app from where you’ll extract data) and another app (or apps) as the Action (where the data will be sent).
Let’s say you want to extract tweets that mention your brand in real time. You could use Zapier to connect Twitter with Google Sheets and gather tweets as soon as the Zap detects your brand name in tweets:
Go one step further and connect Zapier with MonkeyLearn to automatically perform sentiment analysis on your incoming Twitter data. Learn how to create a Zap for sentiment analysis with MonkeyLearn.
IFTTT means ‘if this, then that’. Like Zapier, this tool allows you to connect to different apps so that you can set an action when certain criteria is met. Use it to obtain Twitter data with zero lines of code.
Export Tweet allows you to track a keyword, hashtag or account in real-time, or search for historical data. However, the free version has limitations and we recommend upgrading to take full advantage of the platform.
Tweet Download enables you to download the tweets from your own account, along with the replies and mentions. This is especially useful for brands that want to track which content works best with users, what are the main things that users claim about their product, etc.
The Twitter API lets you access and interact with public Twitter data.
Use the Twitter Streaming API to connect to Twitter data streams and gather tweets containing keywords, brand mentions, and hashtags, or collect tweets from specific users.
Use the Standard Search API to get historical tweets published up to 7 days ago. Alternatives include historical search APIs (like Historical PowerTrack and Full-Archive Search), that can collect tweets from as early as 2006.
Ruby: Twitter Ruby Gem
Once you’ve gathered the tweets you need for your sentiment analysis, you’ll need to prepare your data. Social media data is unstructured and needs to be cleaned before using it to train a sentiment analysis model – good quality data will lead to more accurate results.
Preprocessing a Twitter dataset involves a series of tasks like removing all types of irrelevant information like emojis, special characters, and extra blank spaces. It can also involve making format improvements, delete duplicate tweets, or tweets that are shorter than three characters.
MonkeyLearn is a machine learning platform that makes it easy to build and implement sentiment analysis. You can get started right away with one of the pre-trained sentiment analysis models or you can train your own using your Twitter data.
Either way, sign up to MonkeyLearn to gain access to the pre-trained models and the model builder.
Then follow this tutorial to perform sentiment analysis on your Twitter data.
1. Choose a model type
Go to the MonkeyLearn dashboard, then click on the button in the right-hand corner: ‘Create a model’, and then choose ‘Classifier’:
2. Decide which type of classification you’d like to do
From the list of classifier type; click on ‘Sentiment Analysis’:
3. Import your Twitter data
The data you import will be your training data, used to train your machine learning model. Upload Twitter data from a CSV or Excel File, then select the columns you want to use:
5. Tag data to train your classifier
Now, it’s time to train your sentiment analysis model, by manually tagging each of the tweets as Positive, Negative, or Neutral, based on the polarity of the opinion. After tagging the first tweets, the model will start making its own predictions. You can correct them if the answer is not correct:
6. Test your classifier
Once you have trained your model with a few examples, you can paste your own texts to see how the sentiment analysis model classifies it:
MonkeyLearn provides different stats to measure the performance of your sentiment analysis classifier. These are accuracy, F1 score, precision, and recall. You can also find a Twitter keyword cloud featuring the most frequent terms for each sentiment.
If you are not able to see all the stats, it might mean that you need to tag more data. In this case, for example, the model requires more training data for the category Negative:
Keep in mind that the more training data you tag, the more accurate your classifier becomes. Another way to improve the accuracy of your model is to check all the false positives and false negatives and re-tag the incorrect ones. Here’s how:
Now you’ve got a sentiment analysis model that’s ready to analyze tons of tweets! The next step is to integrate the Twitter data you want to analyze with the sentiment analysis model you just created. There are three ways to do this with MonkeyLearn:
Batch Analysis: Go to ‘Batch’ and upload a CSV or an Excel File with new, unseen tweets. The classifier will process all the tweets and provide a new file with the results of the sentiment analysis.
Integrations: there are several integrations available you can use to analyze new data with your sentiment analysis model. For example, you could use Google Sheets as an input for your data or Zapier to connect Twitter data to MonkeyLearn.
To learn how to analyze your Twitter data in Python using MonkeyLearn’s API, check out this guide on performing sentiment analysis in Python
Data visualization tools help explain sentiment analysis results in a simple and effective way.
Take a look at how MonkeyLearn Studio visualizes results from an aspect-based sentiment analysis on Twitter data. MonkeyLearn Studio is an all-in-one text analysis and data visualization suite, featuring ready-made business templates.
Perform sentiment analysis on your Twitter data right away, and filter your results in MonkeyLearn’s dashboard so you can hone in on negative or positive comments and make data-based decisions on the go.
Other popular data visualization tools include:
You can use this free and simple Google platform to create interactive reports. There are more than 100 sources available to import your data, including CSV, Excel, and Google Sheets. Once you’ve designed your visual report, you can share it with other teams or individuals.
This is a business data analytics platform, created to manage all sorts of data within the different areas of a company. You can connect with different databases and create charts and data tables. Learn how to get started.
Defined as business intelligence and analytics software, Tableau allows you to work with a large number of data sources to create dynamic dashboards and compelling data visualizations. One of the best things about Tableau is that is very easy to use and doesn’t require any coding skills. However, it offers different types of products and some of them are targeted to developers.
Twitter sentiment analysis provides many exciting opportunities. Being able to analyze tweets in real-time, and determine the sentiment that underlies each message, adds a new dimension to social media monitoring.
Here are some of the most common business applications of Twitter sentiment analysis.
Online reputation is one of the most precious assets for brands. A bad review on social media can be costly to a company if it’s not handled effectively and swiftly.
Twitter sentiment analysis allows you to keep track of what’s being said about your product or service on social media, and can help you detect angry customers or negative mentions before they they escalate.
At the same time, Twitter sentiment analysis can provide valuable insights that drive decisions. What do customers love about your brand? What aspects get the most negative mentions? This tweet, for example, indicates that fast shipping is one of the most valued aspects for this Amazon customer:
Aspect-based sentiment analysis with Twitter can show you which aspects of your business need to be improved and what makes you stand out among your competitors.
It has become increasingly important for customer service agents to be present on Twitter. They need to engage with customers and respond quickly to customer queries: six out of ten users expect a brand to respond to any customer service requests within one hour.
But how can you detect which support queries are most urgent? Twitter sentiment analysis allows you to track and analyze all the interactions between your brand and your customers, so you can make sure you respond to the most critical issues first.
Twitter is a major source of consumer insight. In fact, people use it to express all sorts of feelings, observations, beliefs, and opinions about a variety of topics.
You can use Twitter sentiment analysis to track specific keywords and topics to detect customer trends and interests. Understanding what customers like, what their behaviors are, and how this changes over time is essential if you are planning to launch a new product.
Here’s an example of how Twitter sentiment analysis was used to monitor 4,000 tweets that mentioned halal food. This information allowed researchers to identify different motivations for halal food consumption and segment their market into different types of consumers.
Twitter sentiment analysis can also help you stay one step ahead of your competition. By identifying competitors’ pain points, you can focus on these areas when promoting your business.
Whether you are launching a new feature on your platform, a site redesign, or a new marketing campaign, you may want to track customer reactions on Twitter.
Taking action and making changes or improvements in real-time will help maintain customer loyalty, and can even help spread the word about your new feature.
A huge part of Twitter conversation revolves around news and politics. That makes it an excellent place to measure public opinion, especially during election campaigns. Twitter Sentiment Analysis can provide interesting insights on how people feel about a specific candidate (and you could even track sentiment over time to see how it evolves).
During the US 2016 elections, we performed Twitter sentiment analysis using MonkeyLearn to analyze the polarity of Twitter mentions related to Donald Trump and Hillary Clinton. First, we were able to count the number of positive and negative mentions for each candidate during a period of time. This graph shows Trump’s tweets based on sentiment:
In contrast, the following graph shows the number of positive, negative, and neutral mentions for Hillary Clinton:
Another relevant insight consisted of analyzing the tweets on specific dates, for example on the day of the presidential debate and observing negative or positive reactions, as well as the main keywords mentioned during that day.
Sentiment analysis helps you monitor your customers emotions on Twitter and understand how they feel. It adds an extra layer to the traditional metrics used to analyze the performance of brands on social media, and provides businesses with powerful opportunities.
Yes, you could sort data by sentiment manually, but what happens when your data starts to grow? Sentiment analysis with machine learning is simple, fast, and scalable, and can provide consistent results with a high level of accuracy.
June 7th, 2019