Guide to Text Mining with Sentiment Analysis

Guide to Text Mining with Sentiment Analysis

The majority of information created these days is unstructured data, meaning it doesn’t fit into a neatly defined structure or framework. Most of this data is in the form of text: social media posts, emails, online reviews, business reports, etc. 

There are huge amounts of insights available for the taking from this data – right down to the actual opinions and emotions of the writer. Just think about the ability to automatically tap into tweets, Facebook posts, and blogs about your brand with almost no human interaction needed.

Text mining with sentiment analysis offers an AI-guided solution to get your hands on all this useful information, to analyze data about your brand, and let you know exactly what your customers (and the general public) are thinking and feeling.

Read on to learn more.

What Is Text Mining with Sentiment Analysis?

Sentiment analysis (opinion mining) is a text mining technique that uses machine learning and natural language processing (nlp) to automatically analyze text for the sentiment of the writer (positive, negative, neutral, and beyond). 

The overall purpose of text mining is to derive high-quality information and actionable insights from text, allowing businesses to make informed decisions.

Powerful machine learning algorithms can easily recognize statements as Positive, Negative, or Neutral. And you can get even more granular results when you put aspect-based sentiment analysis into practice. 

Aspect-based sentiment analysis takes it one step further, by organizing text like customer feedback or product reviews, first by category (Features, Shipping, Customer Service, etc.), and then mining text for sentiment so you can see which categories are positive or negative.

It allows you to analyze thousands of online reviews or social media comments in just minutes.

However, before performing any kind of sentiment analysis, you’ll need to break down comments, paragraphs, or documents, into smaller fragments of text. Customer feedback, for example, often contains multiple ideas or opinions, so analyzing the overall sentiment of reviews, tweets, documents, and so on, may result in a neutral classification. 

To get the most accurate results when mining for sentiment, you’ll need to use an opinion unit extractor, which separates comments into individual opinions. It can be performed in just seconds on hundreds of pages and thousands of standalone opinions. 

Here’s an example of how extracts different sentiments or ‘opinion units’.

Opinion Unit Extractor extracting three separate opinions: “I like the new update,” “but it seems really slow,” and “I can’t get tech support on the phone either.”

Next, you can organize these opinions into aspect categories. For the above example, based on a software review, the aspect classifier will tag our opinion units to fit into categories: Features, Ease of Use, Customer Support, etc. Once they are separated into aspects, we can then perform sentiment analysis. In the end, each opinion unit is classified by both topic and sentiment:

Opinion units classified by aspect and sentiment.

This means you can get data on thousands of reviews in just minutes to find the most positive and most negative statements, find out what aspects of your business are most positive or most negative, extract the most important keywords, and more. And the process can be chained together to work automatically and seamlessly with almost no need for human input. 

Machine learning programs even allow you to train models to the language of your business and your own specific criteria. You simply feed training data into text analysis programs, tag the samples to your criteria, and machine learning algorithms learn how to process the text to the training criteria you set up. 

For example, sentiment analysis with text mining, you’d tag individual opinion units as “positive,” “negative,” or “neutral,” and the algorithms will learn how to extract and classify similar text features according to your training.

Flow chart showing how Sentiment Analysis works: Text goes through “feature extractor” then a machine learning algorithm that outputs a classification tag.

Read on to learn how to train your own sentiment analysis model in just a few steps or explore MonkeyLearn Studio to see how you can use text mining techniques to sort your data.

Sentiment Analysis Examples in Business

There are thousands of useful applications of sentiment analysis to get data-driven insights for your business. Below are just a few, but they’ll give you an idea of what sentiment analysis with text mining can do for you. 

Monitor your brand reputation on social media

Whether on Twitter, Facebook, Instagram, YouTube, and on and on, with sentiment analysis you can keep your eye on your brand reputation in real-time, and monitor for changes over time. Find out immediately when negative comments arise so you can see to them immediately, or increase your brand image by engaging with positive comments. 

Follow trends within your industry with comparative brand analysis, or perform specific analyses to find out how a marketing campaign may be working or what customers are saying about new products.

A tweet to @slackHQ complaining of a technical issue. Slack responds with a solve. The issue resolves itself, but the user thanks Slack for the response.

Gain insights from customer feedback and reviews

Customer feedback and reviews can come from direct communication (survey responses, customer service data), from reviews in news reports and blogs, or completely unsolicited on social media and beyond. When you train a sentiment analysis model for the language of your industry and your specific criteria, you’ll be able to process thousands of pieces of feedback in just minutes and much more accurately than humans could ever do. You can target areas of your business and compare them to find out what you're doing right and what you may need to work on.

Prioritize customer issues

Analyze your customer service tickets from chatbots, emails, phone calls, web queries, etc., categorize them by subject, and automatically route them to the correct department or employee. Beyond this, sentiment analysis can score customer support tickets for urgency or degree of irritation, happiness, disappointment, etc., to make sure the most urgent issues get taken care of right away. Never leave your clientele in the cold again, and ensure positive customer experiences.

Tutorial: Text Mining with Sentiment Analysis 

You have two options for performing sentiment analysis: create a model from scratch or use a SaaS tool.

Build vs. Buy Text Mining Software

Creating a model from scratch is basically only an option if you have years of data science and coding experience or plan to hire an entire team of engineers. There are plenty of open source libraries available to assist, but it can be a time-consuming and costly process. This sentiment analysis with text mining tutorial can be helpful if you’re ready to build your own.

SaaS tools, on the other hand, can be extremely easy to implement and much more cost-effective, as you only use what you need. Furthermore, SaaS tools allow you to train a customer sentiment analyzer in just a few steps. 

MonkeyLearn is a SaaS text mining platform with dozens of tools and hundreds of easy-to-set-up analytical configurations to extract a wide range of valuable insights from the vast world of unstructured data.

Try out MonkeyLearn’s pre-trained sentiment analyzer to see how it works right now. Or explore MonkeyLearn’s tools for free. Then, test MonkeyLearn’s tools for yourself by creating a sentiment analysis model – no code needed. Here’s how:

1. Choose your model type

Once you’ve explored MonkeyLearn, you’ll be able to access the dashboard. Just click ‘Create a model’, then ‘Classifier,’:

The option to choose a model type: Classifier, Extractor, or Workflow.

2. Click ‘Sentiment Analysis’:

MonkeyLearn's creation wizard showing classification options: topic, sentiment, and intent.

3. Import the data you want to analyze

You can import data from one of the app integrations or upload a CSV or Excel file. This is the data you'll use to train your sentiment analysis model. For this tutorial, we’re using a CSV with hotel customer reviews. 

If you don’t have a dataset handy, you can click ‘Data Library’ to download a sample.

MonkeyLearn's creation wizard showing available sources to upload your text data.

4. Start tagging text to train your sentiment analyzer

Tag each statement as Positive, Negative, or Neutral to train your model based on your criteria. Once you tag a few, the model will begin making its own predictions. You can correct them if the model has chosen wrong.

Showing how text is tagged as Positive, Negative, or Neutral.

5. Test your new custom model

You'll be prompted to name your model, then you can test it to see how it’s performing. Copy and paste new text or enter your own:

Test with your own text



If it’s still not performing accurately, click ‘Build’ to do more training. The more you train your model, the better it will perform.

Showing how to return to 'Build,' to more thoroughly train the model.

Click on ‘Stats’ to see a variety of sentiment analysis statistics that give an idea of how well the model is working. You’ll see overall statistics or click through to see by Negative, Positive, and Neutral, individually.

The world cloud on the bottom gives a visualization of word frequency and the most important words in your analysis.

Integrations that can be used with sentiment analysis.

6. Put your machine learning to work

Once your model is trained, you can analyze huge amounts of data at once. MonkeyLearn offers three ways to upload your data:

  • Batch Analysis: upload a CSV or Excel file with new text. MonkeyLearn will process the data and automatically provide your sentiment analysis results.
  • Integrations: MonkeyLearn has a number of simple integrations with apps you may already use:
Integrations that can be used with sentiment analysis.
  • The API allows low-code plug-ins for easy integrations:
An example of API code.


Text mining with sentiment analysis offers powerful data analysis insights and dynamic results, no matter the type of text you need to analyze. And once you train a sentiment analyzer to your specific needs, you can analyze your unstructured text at speeds and levels of accuracy you never thought possible.

Explore MonkeyLearn to learn more. Our suite of text mining tools go far beyond sentiment analysis into more tools that you can use in concert for even more granular results.

Rachel Wolff

September 9th, 2020

Posts you might like...

MonkeyLearn Logo

Text Analysis with Machine Learning

Turn tweets, emails, documents, webpages and more into actionable data. Automate business processes and save hours of manual data processing.

Try MonkeyLearn
Clearbit LogoSegment LogoPubnub LogoProtagonist Logo