Conversational UI using MS Bot Framework and LUIS

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.

Language Understanding

To resolve the language understanding problem, Microsoft has introduced a cloud service called “LUIS” (Language Understanding Intelligent Service) as one of it’s so called Cognitive Services.

Conceptual image of 3 applications feeding information info LUIS

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

Example:

Intent: Get info about the weather

Utterance samples:

  • 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

Utterance samples:

  • 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:

  1. Intents
  2. Utterances
  3. Entities
  4. 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 😉

 

Advertisements

Tools to detect websites’ techs

As a web developer, most of the time I come across cool stuff (technology-wise) once I’m surfing the web and I’m always wondering, what kind of framework, library or technology has been used for their development.

I used to go with old school methods like viewing the website’s source code or inspecting elements (through dev tools) in my browser to grasp the libs and frameworks used in the web page. But you know, it takes time and thought, sometimes the code doesn’t make much sense and for some libraries about which we know almost nothing , it gets tricky to realize how things are working in the page.

In this post, I’m goint to introduce some handy tools I’ve found to detect tech stuff quickly with actually no effort.

One of my favorite tech detectors is Wappalyzer, which is actually an add-on for Chrome, Firefox and Opera browsers. You just need to simply install the add-on and that’s it! Once you’re surfing the web it’s going to show you all the detected technologies through icons in your address bar.If you click on the icons, it shows a full list of the used stuff. It can detect the server-side tech stacks/platforms, web servers, even the CMS used, and all the JavaScript libraries. If you’re wondering about any of them you can see a brief introduction to the tech in the Wappalyzer website (by clicking on tech name in the list) and go to the official website of the pertinent technology.

wappalyler

Builtwith is another cool  web-base tech detector I normally use. All what you need to do is to put the URL in www.builtwith.com and see the result. It shows much more details about the hosting, and server-side aspects.

ebay