Classifiers let you interpret words and phrases into intents you can act on. Various services let you train your own classifier which you can then use in your flows to draw meaning from the unstructured text contacts send you.
We support the following classifier platforms:
Wit.ai is a Facebook owned natural language platform that supports up to 132 languages. The service is free and easy to use and a great choice for small to medium sized bots.
LUIS is a Microsoft Azure platform that lets you interpret natural language in your bots. It supports 13 languages and is a highly scalable paid offering.
Bothub is an Open Source NLP platform. It supports 29 languages and is evolving to include the languages and dialects of remote cultures.
Create your Bot
In our example, we've used wit.ai. Wit allows you to extract relevant pieces of information — or entities — from what your contacts might say to your app in a flow. Train your wit bot to understand what your contacts communicate and respond appropriately. Check out Wit's tester bot and help docs to see how it works.
To get started, navigate to wit.ai and click on the 'Bots' button. Log in with either your Facebook or GitHub account.
That's all it takes to create your first bot. Next, you'll need to train it. You'll teach your bot to extract entities (information) based on relevance.
In the example below, our app will allow contacts to set reminders. Here, the contact is asking the bot to remind them to call the dentist the following day. We've matched the rules
wit/datetime to their appropriate entities in the sentence. This will teach the bot to pull out similar data from free text and understand the contact's request.
To better understand how to use Wit, be sure to follow their quick start guide!
Connect your Bot
After you've created and trained your bot, you're ready to integrate it into your account. Visit your account page and click the ☰ menu icon in the top right corner. Choose 'Add Classifier' from the dropdown menu:
Then choose your preferred service:
You'll need to authenticate your account to connect it. Find these details in the API section of your service's account page. In the case of Wit, we'll enter the bot's name, App ID & Access token:
Build your Flow
In the example above, we've built a flow to ask customers of a travel agency to send their inquiry. After asking a question like, "What can I help you with?", contacts will send unstructured free text captured in the flow using a 'Wait for Response' split action. We'll be sure to use 'has some text' or 'is not empty' to be able to collect the response from the contact.
Next, we'll use the 'Split by Intent' split action in the flow to run the response through the classifier (our Wit bot) and create rules to extract the intent from the text. You'll see a dropdown of all possible intents pulled from the training you've done with your bot. In our example, we're looking for a response with the entity "flight" that will tell us that the contact wants to book a flight with our agency. Remember, we've already trained our bot on wit.ai to understand this intent.
Say the contact responded to our first question with "Book a flight to Miami". The classifier will extract "flight", as programmed during training, and understand that the contact wishes to book a flight. Here's how that looks in the contact's message log:
We can see above that the bot has successfully extracted the entity "flight".
If you find that your bot doesn't understand the unstructured text from your contacts, continue training it so that it can continue to learn.
Referencing entities in your flow
Within your flow, you can access the entities that are extracted from the classifier using the variable
@results.classify.extra.entity_name. You can then work that in your reply message. This means that in our sample flow, we'll reference the entity using
@results.result.extra.destination. Note that
result is what we named our 'Split by Intent' result and
destination is the name of the entity from our Wit bot training.
Here's how that looks:
Using the simulator to test the flow, we can see how we've pulled out the entity and referenced it using the variable
@results.result.extra.destination and how it looks in our reply message to the contact:
What's the difference between 'has intent' and has 'top intent'?
Has intent will match if the intent is found with a higher confidence than specified in the rule.
Has top intent is the same, but only if it is also the highest confidence amongst all intents.
Questions? Send us a message via the support widget in the bottom right corner of your browser.