[Azure] Cortana skills + LUIS pre-built domains
A while ago I was planning on doing a few posts on bots, but I never really got to that it seems. I did get into the bot building business though, so here’s one about a little bit more advanced use of bots: language understanding. And although I might write “more advanced”, I don’t really mean it. That’s because LUIS makes things so much easier. LUIS? Yeah, that’s short for Language Understanding Intelligence Service. And it’s awesome.
So what exactly is LUIS? In my own words: it’s a service that can help any piece of software to understand human spoken (or usually typed) language and ‘translate’ it into something the computer can work with. The heart of this is the notion of an intent.
To illustrate this, I’m going to use a real world example of an app I’m considering to build. This app will provide a speech interface to control Domoticz, home automation software. You can configure Domoticz to work with Alexa, Siri and probably Google too, I’d like to add Cortana to that mix.
To teach Cortana new things, we can use the Cortana Skills framework. You learn Cortana new skills by learning her how to interpret certain commands and what to do with them. Previously this was done using a VCD file. The problem with those kinds of definition files is that they’re not really flexible.
The new Cortana Skills framework utilizes the bot framework. Is makes sense when you think of it: Cortana is basically a bot as well and also needs to interpret what we say. So why not use the same back-end, right?! So to learn Cortana new skills, we’ll create a bot to back her.
Back to LUIS. Cortana and LUIS make a great couple. Where Cortana takes care of translating speech into text, LUIS can then help in understanding what it actually was the user was meaning to do. This is the intent we already mentioned above. So an intent might be “please turn on the lights in the living room”.
Of course it’s a little bit more complicated than that. This sentence contains multiple pieces of information: turn on, lights and living room are things we’re interested in.
- The user wants to turn on something (intent)
- That ‘something’ are the lights (device)
- And those lights are located in the living room (location)
The same intent can have all kinds of forms, for instance: “in the living room, please switch on the lighting”. Not only are we using different words, the construction of the sentence is also different. LUIS will help in making sure all these commands are executed by the right piece of code.
You can imagine that there is quite some overlap in intents that certain applications might handle. That’s why Microsoft is now offering pre-built domains as ‘templates’ for your LUIS apps. All of these domains are sets of intents within a certain domain (category). At the moment, the following types are available:
Quite a list, right?! Now what do you gain from using one of these? A lot actually! Powered by Machine Learning, you will import entities and intents that are already set-up for action. The only thing you need to do is plug in the code. And should you not like something in the pre-built models, you can change things as soon as you’ve imported one.
In future posts I’ll explain further how I use Cortana and LUIS to automate my home automation even further. Stay tuned!