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 users 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.
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
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. When people can express meaning in a lot of different ways it is a complex intent. Later, to improve classification quality, it is needed to extend training 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 user 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
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.
It is a common situation, when user can say phrase with multiple intents. To extract all intents from phrases you need to use
Define a list of intents that can be in one phrase at the same time. Make sure that it is a list of lists, because you can add multiple intent combinations.
With this feature, you don't need to add phrases that, have both (or more) intents at the same time to dataset. Just use separated ones. Anyway if you want to add phrases with multiple intents to dataset, add it to both intent includes examples
If you have an intent that may have an opposite meanings, but overall meaning is the the same, create intent with a positive or negative state. To create intent with a positive or negative state, you need to name intent with
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")
If you have entities in intent phrases, you need to annotate them in training examples. It's obligatory to annotate all of them to train your model correctly.
There are two equivalent options to markup entities in phrases:
- Value-Entity brackets:
- Square brackets:
[ "Deliver (Nic-o-boli)[pizza:order] to (5 Lombard Street)[address]", "Deliver [pizza:order] to [address]", ]
Don't forget to define an entity.
Read full named entity documentation here.