A couple of weeks ago we had an innovation day in our company, which is a 1 day event to pitch our new ideas for improving the product by doing a draft code as a proof of concept. Pretty cool ideas came out of it, in this post though, I just want to share the idea that I pitched and worked on it with some of my colleagues. To implement the idea we used 2 new technologies/cloud services:
- Microsoft Bot Framework
- Microsoft Language Understanding Intelligent Services (LUIS)
Idea: Bots, a new breed of UI
The idea we pitched was actually creating a conversational UI working side by side with the current web app, to make life of users easier. Let me put it this way: as a user, would you rather to login to a web app, click on menus, fill the forms to get what you want or just tell someone do all those stuff and just answer a few questions?
Take booking a flight ticket as an example, would you rather to sign into booking websites fill the search forms to search for the cheapest flight with minimum stops from Sydney to Seattle or just open up your Skype and say :
“Find me best cheap flights from Sydney to Seattle in early August” and get a list of flights to choose from as a result?
Naturally users would prefer the latter unless they’re so used to and stuck to the former that they don’t want to get out of their so called comfort zone to feel the real comfort, at least once!
One of the major challenges to achieve this sort of conversational user experience, is: “Human Language Understanding”. If we want to make life easier for our users, we can’t force them to ask for what they need in a certain way, like the old school command/prompt method. Users should get to say things in their own way and it’s our app’s responsibility to understand it. That’s where ML (Machine Learning) and AI (Artificial Intelligence) comes in.
What you need to do is simply create an account to login to LUIS, and create a LUIS app. The LUIS app will provide you with a Web API that you can call with a text input (user’s question for instance), and get the analyzed result, through which our Bots can understand what user wants.
LUIS in a nutshell
The idea is, whenever a user asks a question or makes a statement, the question or the statement actually projects an intention. For instance, user may either ask a question about the weather, or the price of company’s share in stocks market. These 2 kinds of questions, are identified as 2 different purposes. But these questions could be asked in various ways. In LUIS terminology, we call the former “Intent” and the latter “Utterance”
Intent: Get info about the weather
- How is weather tomorrow?
- What’s the temperature right now?
- Is it going to rain on Monday?
- How likely is to have a rainy day this week?
Intent: Get info about the price of stocks
- What’s the price of Amazon stocks?
- Price of AMZN
- How much is Facebook’s share price?
As you noticed, apart from an intent, each question or statement has got some specific keywords in it. In LUIS we call them “Entity“.
Take this question as an example: “How is the weather tomorrow?”. The intent is “Get information about the weather”, and the keyword or the entity is “Tomorrow” which is a date. Asking such a question, user needs some info about the weather in a certain date which is tomorrow. In case of this question: “What’s the price of Amazon stock?”, then intent is “Get price info of stocks” and the entity is the “Amazon”.
So the idea behind the LUIS is as simple as that. It’s based on 4 main concepts:
- Roles (roles are actually entity’s role, for instance when buying tickets we got location entities but the “depart from” and “destination” are 2 different roles of the location entity, click here to learn more about roles if interested)
As you may know, in machine learning, we give our model a set of sample inputs and outputs to train the model, so that for any given input returns an acceptable result. In LUIS, the set of inputs are actually a list of utterances, and the set of given outputs are the intents and entities (and in some cases roles) extracted from the pertinent utterance. Then we train our LUIS app based on those given inputs and output and expect the LUIS app to return the Intent(s) and entities of any given question or statement.
Here you can see a good tutorial of how to do that in LUIS : https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-quickstart-primary-and-secondary-data
The cool thing about the LUIS is that at the time of writing this post, it supports around 12 languages. You can see a list of supported languages here: https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-supported-languages
Assuming that now you know about how to create a new LUIS app, what I’m about to talk through in next article is how to get it working with a bot made on MS Bot Framework, so stay tuned 😉