Custom intents

Training phrases

To create intent classification model you need to define training examples in data.json file in intents section. Don't forget to connect dataset file to the application. Also, custom intents may work simultaneously with system intents.

Training phrases are example phrases that interlocutors might say to the dialog system during the conversation. The classification algorithm is training using these examples. For each intent, you need to provide phrases that correspond to this meaning.

Section intents is a dictionary, where the key is an intent name and the value object contains training examples.

There are two possible types of training phrases:

  • includes: examples that have this meaning
  • excludes: examples that don't have this meaning

Includes examples

In this section, you need to provide example phrases for each intent. Example phrases represent intent meaning. Dasha's intent classification uses machine learning algorithms to understand the semantic and contextual similarity of the phrase.

You don't need to specify all possible phrase variations. It's recommended to specify 5 - 10 - 20 phrases (depending on complexity) for each intent. Later, to improve classification quality, it is needed to extend training examples.

Excludes examples

In this section, you can specify phrase examples for each intent that don't have this intention in fact. These examples will help to train the model better and decrease possible false positives. For example, an interlocutor can tell some phrase similar to any existing intent but doesn't have this meaning. Then you can add these phrases to excludes. It is assumed that you will add phrases to this section when check how well the model works after new calls are conducted. There is no need to provide these examples when you train the model the first time.

If you want to create only one intent, you need to provide examples to includes and excludes. Add in excludes approximately the same number of phrases as includes. These might be phrases that have different meanings.

If you want to create more than one intent, excludes phrases are optional.

Positive/Negative intent states

If you want to create intent with a positive or negative state, you need to name intent with #pos #neg postfix.

Intents have a positive state by default. Even if you don't specify postfix, it will be positive.

Then, in #messageHasIntent function pass state value of the intent:

#messageHasIntent("agreement", "positive"); #messageHasIntent("agreement", "negative")

Named entities in intent phrases

If you have entities in intent phrases, you need to annotate them in training examples. It's obligatory to train your model correctly. Use the following format to do this:

(value text)[entity_name:tag]

For example:

Transfer money to (deposit account)[account:target]

Don't forget to define an entity.

Read full named entity documentation here.