Inputs define events that a bot can react to. They can come from users (user queries) or from systems (triggers).
When receiving a user query, the bot will extract:
- an intent: it represents what the user is trying to express.
- entities: they represent valuable piece of information that the bot will use later on.
An intent usually corresponds to an action: asking something, requesting something or simply expressing something.
The first step to developing a skill is to identify the list of intents that we want the bot to handle. One way to do this is to list all possible things a user might say and then group them by similarity.
Let’s say we’re developing a skill for weather information. Possible intents might be:
- ask what the current weather is
- ask what the weather forecast is
- ask whether it’s going to rain
- ask whether it’s going to be cold
In order to teach a bot how to recognize the user intent, you need to provide many examples for each of the possible intents. Those examples should illustrate various ways of expressing the same intent.
Here are some examples for expressing the first intent
ask what the current weather is:
- what’s the weather like?
- show me the weather now
- what is the current weather
- how’s the weather
- give me some information about the weather
The more examples you provide, the more accurate the intent recognition will be. It is recommended to provide at least 10 examples for each intent. Beta-testing your bot with a small group of users is a good way to find examples you didn’t think of in the first place.
A local intent is usable only within its skill. A shared intent doesn’t belong to a specific skill, it is global and can be used by multiple skills.
You can use the Test button on the right side of the intent list to input some queries and check whether the system recognizes the expected intent.
An entity usually corresponds to a noun, some value that we want to extract from a user query.
In our weather example, we might want to extract the following entities:
- date and time
In order to teach a bot how to extract entities, you need to tag the previous examples to indicate where the entity is located in the sentence. This can be done simply by selecting the text corresponding to the entity in the example, and then typing a new entity name or selecting an existing entity in the list.
If there are a lot of possible values for an entity, it is not convenient to add an example for each possible value. In addition to tagging examples, you can create or select an entity from the
Inputs page and provide a list of possible values. During the training phase, the system will automatically generate additional examples using these values based on the provided examples.
Allow unknown values indicates what the skill should do when it finds a possible value for an entity that was not given in any example and not provided in the list of entity values. If this option is enabled, the entity will be extracted, otherwise it will be ignored and no entity will be extracted. Only disable it when you have a finite list of entity values and you don’t want any other value.
For each entity value, you can provide
synonyms. In case a synonym is recognized, the corresponding entity value will be extracted instead.
Let’s say we have an entity
Country. One possible value is
USA. If we add a synonym for
United State of America, when a user types a sentence with
United State of America, then the entity
USA will be extracted.
A local entity is usable only within its skill. A shared entity doesn’t belong to a specific skill, it is global and can be used by multiple skills.
Just like intents, you can use the Test button to input some queries and check that the system recognizes the proper entities.
A trigger is an event that doesn’t come from a bot user, but from a system. It can be: