In this tutorial, we will walk you throught the creation of a simple calculator assistant with the Snips Console. It will be able to calculate arithmetic sums. That is, it will capable of understanding sentences such as:
What is 25 plus 12?
or variants thereof, such as
Can you tell me the sum of 75 and 9?
Once the assistant has been created in the console, it can be deployed to a device such as a Raspberry Pi, and Android or iOS device, or a Mac. This is the topic of other guides in this Getting Started series.
If you haven't already, head over to console.snips.ai and create a new account:
Once signed up, you will be prompted to create your first assistant. If it's not your first sign in, click on Create a New Assistant:
Enter the basic assistant info. For this tutorial, we will name our assistant HelloSnips, and use English as language:
Next, we will create a simple app. Click on Add an App, which opens the Snips app store window. You may select among preexisting apps, but for this tutorial, we will create our own. Therefore, click on Create a New App and give your app some basic information. We are creating a calculator app, so we will name our app Calculator:
Tap Create, and the select the newly created card from the list of apps. You should see the following:
Congratulations! Your app is now created, and we can start training it with intents.
In the app's properties panel, click Edit App. This brings up the App Editor.
Click on Create New Intent. We will create a simple intent that handles queries like "What is 3 plus 5?", that is, asking the sum of two numbers. We will call this intent ComputeSum:
Once created, the Intent Editor is brought up. This is where we will feed the intent with some training sentences.
We start by defining the type of slots that our intent needs. In a sentence like "What is 3 plus 5?", we want to extract the numbers 3 and 5 as slots to our intent. So we name these slots firstTerm and secondTerm and indicate that they are of type snips/number.
Now, we are ready to train our assistant with some examples. In the Training Examples panel, we enter a few sentences, and tag the slots accordingly.
A few phrases will do for now:
Once done, we save the intent, which will automatically trigger a training of the model. Once done, we can test that it works by entering a sample phrase. This will display a JSON output, with the correctly parsed intent and slots.
Your assistant is now ready for use! It's time to deploy it to your device, and write code that reacts when an intent has been detected.
If you plan to deploy your assistant to a Raspberry Pi, you can create code directly in the console and deploy it to your device without further setup. Make sure to check our the following articles:
For other platforms, make sure to go through the following: