Create Custom Text Classification Models Based on Topic, Sentiment, Intent

Editor Ratings:
User Ratings:
[Total: 0    Average: 0/5]

This article talks about a simple method to create custom text classification models based on topic, sentiment, or intent. Text classification is done with the help of machine learning but creating an ML-based text classification model is not everyone’s cup of tea.

MonkeyLearn is a web-based text classification service that offers a simple way to create an ML-based model for text classification without any technical knowledge. This service allows you to create custom text classification and text extraction models that you can train with data files.  In the case of text classification, you can create models for topic, sentiment and intent classification. After training the model, you can use it to classify text in batch. You can also use API for the same or directly integrate the model to Zapier, Google Sheets, Rapidminer, and Zendesk.

In the free-tier, you are allowed to create 1 custom model which you can either use for text classification or text extraction. In either case, you are limited to 300 queries per month. The API also has a limit of 30 requests per minute that allows you to do up 6,000 queries per minute. The free model size allows up to 1,000 training texts per custom classifier and 150 for the custom extractor.

Also read: Text Analyzer with Readability Score, Auto Summarization, Sentiment Analysis, Keyword Analysis

Create Custom Text Classification Models Based on Topic, Sentiment, Intent

To create a custom text classification model create a free account on MonkeyLearn and verify your email address. Here, I’m going to focus on the text classification part only. The text extraction part is very similar to this.

Import Text Data

ml based text classification

The very first step of creating a text classification model is to import text data for training the model. This service offers various ways to import data along with two sample data libraries for testing. You can either import your text data from Excel or CSV file or connect with the following apps to import data directly:

  • Twitter
  • Gmail
  • Zendesk
  • Front
  • Promoter
  • Freshdesk
  • RSS
  • Data Library

Select Texts for Classification

text classification for sentiment

When you import the data, it analyzes the data and checks if it is properly structured or not. Don’t worry, you won’t have to follow any strict format rules, just make sure that sentences are separated from one another either by comma, semicolon, or linebreak. After successfully importing the data, you can select which columns you want to use for the model training. Since the free-tier has a limitation, this option is a nice inclusive that comes handy for long files.

Classification Type

text classification for topic

After importing the data, the next step is to choose what kind of classification you want to make. This service offers the three types of classification which are as follows:

  • Topic Classification: Classify text based on topic, aspect, or relevance.
  • Sentiment Analysis: Detect sentiment in the text e.g. positive, negative, or neutral.
  • Intent Classification: Classify text based on intent e.g. complaint, request, feedback.

Train Model

text classification for intend

When you select the classification type, it takes you to the model training section. Here it shows you one random sentence at a time and asks you to tag it as per the selected classification type. Be cautious and as accurate as possible while training the model as it going to reflect what you teach it in the output. The more you train the model the more accurate it would become.

After initial training, you can check your data along with the stats which shows the number of tags, classifications, and keywords. You can also begin another training session to further improve the model.

Use Model for Text Classification

ml based text classification with api and batch mode

After initial training, you can start testing the model. You can test the model for your own custom text and check if it is accurate enough or not. If it’s not accurate enough, you can train it again from the Build tab. Otherwise, you can go ahead and use it for text classification.

MonkeyLearn offers 3 methods to use the model for text classification as well as for text detection. These methods are

  • Batch: You can access this method on the website where you can upload text files for classification.
  • API: MoneyLearn API works with Curl, Python, Ruby, PHP, Node.js, and Java and gives output in JSON format. You can read more on API here.
  • Integration: You can also directly integrate the text classification model to Zapier, Google Sheets, Rapidminer, and Zendesk.

Closing Words

MonkeyLearn offers a simple way to create a custom text classification model with any prior technical knowledge. An average internet user can easily use the service to build their own model within half an hour or so. The direct integration into web apps is really handy and one of the easiest ways to embed the model into your workflow. The free-tier does have limitations but that will be fine for a small model for personal use.

Editor Ratings:
User Ratings:
[Total: 0    Average: 0/5]
Free/Paid: Free