Intents

This document covers all you need to know about intents.

We call intent the intention of the user.

How does intent classification work?

The process of associating intents with a sentence is called intent classification.

Training sets

In the following, instead of sentences, we will use the term utterances. Utterances are more general than sentences because any sequence of characters can be considered an utterance.

A training set for an intent contains examples of utterances classified as this particular intent.

For example, the training set for the buy-shoes intent could be:

I want to buy shoes!
I need some new shoes.
Show me some nice shoes!

In a Botfuel Dialog bot, each intent corresponds to a text file named <intent name>.intent. The content of this file is the training set associated with the intent and each line is an utterance. Theses files are located in the intents directory.

Training and classification

The NLU module, among other tasks, is responsible for the intent classification.

Training

Training is the process of building a model from a training set. In order to train your bot, execute the following command in a terminal:

npm run train

Be sure to train each time you add, remove, rename or change an intent file.

Classification

Given an utterance, the NLU module computes a list of intents with their probabilities. The Dialog Manager then uses this list of intents to execute dialogs. Note that dialogs have the same names as intents.

How to write good training sets?

As a general rule, the more data the better the classification algorithm will perform.

When the bot is live

When the bot is live and used, it is possible to use real user sentences in the training sets.

When the bot is being developed

When the bot is being developed, no real sentences are available and it is often required to write sentences that we imagine the user will say.

One should respect the following rules:

  • Between 5 and 10 utterances for each intent
  • Within a training set, utterances should not be similar, but instead use varied words
  • The more intents, the bigger the training set for each intent
  • Test the bot and, if necessary, iterate by adding utterances or fixing them