Skip to main content

Text Classification

Build a powerful and flexible application for classifying text passages

Text models can be trained to understand the meaning of text passages. We offer a general text embedding model, as well as a specialized text moderation model. This walkthrough shows you how to create a custom text model from our text embedding model.

Create an app

Create a new application and select “Text” as your default workflow.

Add your inputs

Option 1: Browse your files

You can upload your text directly from a .csv file. This means you can work with your favorite spreadsheet software or text editor when preparing your data for upload. Just use the provided "CSV template" to get started.

Next, add your text data. At a minimum, you should add text to the field. You can add one concept per column to the[*].id fields. For the[*].value column, there are two options: enter the number 1 if the concept is present in the input, enter the value 0 if the concept is not present in the input (a negative example). If no value is entered, a default value of 1 will be assigned to your input.

You can add columns for as many concepts as you like, and you can add new columns to add values for any other values supported by the API:

input.idA unique identifier for your input "text" for your input[i].idYour custom concept[i].valueThe value for your custom concept (1 for true, 0 for false)
input.metadataAny additional metadata in valid JSON format for geodata for geodata

Finally, you will need to save your work as a .csv file. If you are editing in Google Sheets, go to File >>> Download >>> Comma-separated values (.csv, current sheet). If you are using Excel, go to File >>> Save As >>> Browse >>> Save as Type >>> CSV.

Once you have downloaded the .csv file, you can then upload it by clicking on “Browse your files”

Option 2: Add text

Just click “add text” and directly enter your text in the text field.

Label your inputs If you “add text” you will need to then label your inputs in Portal.

Add custom concepts

Click on an input and add new concepts in the right hand sidebar. Just click in the empty form field under “Custom Model Predictions”, enter your concept, and hit “return”.

Select Context-based Classifier

  • MODEL ID (OPTIONAL) - Optional custom model ID of your choosing.
  • DISPLAY NAME - This is the name of your new custom model. Enter a descriptive name.
  • OUTPUT_INFO.DATA.CONCEPTS - Click in the empty form field and select all of the custom concepts that you have added one-by-one.

Once you click “Create Model”, a new screen will appear.

Click “Train Model” in the upper right hand corner of the screen.

Try out your new model

Navigate to “Explorer Mode” and “Add Inputs”. Add some new text inputs, and then navigate back to “Explorer Mode”

You will see custom concept predictions in the right hand sidebar when you click on an individual input.