As a reminder, the term ‘Intent’ stands for ‘user intention’ which is meant to be understood by the App through the users’ voice command. In the Smart lights App you just forked, there are 3 Intents for specific commands:
lightsTurnOff --> intent to turn off the lights in the house or a specific room
lightsShift --> intent to change the lights intensity by x% in the house or a specific room
lightsSet --> intent to set the lights in the house or a specific room
You can keep these Intents as they are, they’ll handle voice commands for which they have been trained for. You can also customize them. Let's have a looks!
you want to edit one of the intents of an app you forked, you will also have to fork the intent as well. To do so, go over the intent. You should see a little pen on the right ('lightsTurnOff' in the example below).
Click on the pen and fork the intent.
Once you forked the intent, you'll be redirected to the Intent Editor as showed below.
This Intent Editor enables you to customize your Intent. To better grasp all you can do in the Intent Editor, let's create the 'lightsTurnOff' intent from scratch.
In this example, we're going to create an Intent that aims to understand a user expresses the intention of turning off the lights. Let's go!
First of all, you'll have to create the Intent within your app. Click on 'Create New Intent'.
You will automatically be redirected to the Intent Editor.
In order to create a robust Intent, we suggest the following process:
Choose an Intent name that reflects what the user intention is about. We suggest a name using a camelCase format to keep it short and clean. In addition to the name, add a clear description to the intent. The description is very important as it will be one of the main guidelines to generate data. More on that later.
Here is an example of a clear name and description for your Intent that aims to turn off the lights.
All enabled intents can be triggered when your start the Snips Platform on-device. A disabled intent on the other hand must be programmaticaly enabled first (refer to the Configure message of the Dialogue Manager API for further details). The
Enabled by default option allows you to configure this default behaviour. You might want to uncheck it for intents that will only be used in specific context such as confirmation or slot elicitation, which is out scope for this specific tutorial.
Now that your Intent has a name and description, you're going to add the list of Slots it should contain. A Slot is an entity that must be extracted from your users' query to be understood. Each Slot has a list of values that can be identified in a query. Let's proceed.
Click on 'Add Slot'.
You'll be prompted to enter the Slot name and type. The Slot type can be reused across all your other intents. See it as a reusable entity. The Slot name is just a custom name for this given intent.
In this example, we're going to add a Slot that lists the rooms of a house. So we'll enter 'house_room' as a Slot name and 'room' as a Slot type.
After you entered the Slot type, you'll be redirected to the Slot Type Editor as show below.
Now you're going to enter a few values in 'Manual Slot Type Values'. In this example, we're adding a few room names as show below.
The good news is you don't have to add every house rooms manually. These can be generated automatically! To do so, click on 'Generate Values'.
If the values you previously entered are generic enough, some additional values will be suggested. 51 values in our example.
Click on 'Add this list' and 'Save'. Congrats! You now have 51 values added to your Slot.
Note: You can also add synonyms to each Slot Value (e.g. bedroom). These synonyms will be recognised by your Assistant as the main Slot Type value you attached to it.
Once you're done, finish setting up your Slot by adding a description. Go back to the Intent Editor and click on 'Edit slot description'.
Just like the Intent, enter a Slot description that is clear so that training examples can easily be generated. Click on 'Update' to proceed.
It's now time to add training examples to your intents to train the Automatic Speech Recognition (ASR) and the Natural Language Understanding (NLU) models. The models needs as much data as possible so that the user intention can be caught regardless the way people express their command.
Go to the training examples section and select the text field 'Type your training example...'.
We are going to add 5 training examples as different ways of expressing the same intention that is turning off the lights.
Now you'll need to tag the Slot values within each training examples so that these entities are successfully extracted by your Assistant.
In this example, we'll tag every word that is a house room. To finish, click on Save (bottom right of the Intent Editor).
Congrats! You created your first intent. When it comes to editing an existing intent, one that you forked for example, just stick to the same process.
You should manually add as many training examples as you can to feed the models and make your Assistant is more robust. However, this might be time consuming. Fortunately you can use our Data Generation service to automatically generate lots of training examples rapidly. Let's have a look!
You can use our service to save a lot of time and energy on building your intent. Click on 'Generate'.
Review your Intent and Slot(s) description, and make sure they are clear.
Click on 'Next'. A warning message will notify you if you haven't used each Slot in at least 3 different training examples.
Click on 'Next'. You will see a reminder that your Slot should contains enough values to be more robust.
Click on 'Next'. You'll be offered 3 different options. Choose the one that fits your needs and proceed with your payment.
Well done! You have all you need to create great Intents!