Let us continue with our previous posts on using Microsoft Bot Framework
- Getting Started with Microsoft Bot Framework
- Using Dialogs in Microsoft Bot Framework.
- Using FormFlow in Microsoft Bot Framework.
In this post, we will add natural language processing to our Bot Application through LUIS i.e. Language Understanding Intelligent Service.
LUIS intercepts the User requests and converts it to comparable action for the bot.
The 3 most important aspects of LUIS Framework are
- Intents – Identifies what actions you want your bot to take.
- Entities – What things your bot is taking action on.
- Utterances – Identifies phrases that links intents and entities.
Go to LUIS web site and Sign in
After completing the sign up and finishing other details. Click on My apps link and select New App to create and register the app.
Provide the Name and culture as English and click on Create button.
Now as our app is created, we will now create the intent.
Go to the Dashboard of the app and select Create an intent.
Here we will create “Interest” as our first intent. Next, we define Utterances that points/associates to our intent.
Here we have defined want, interested and like as utterances associated to Interest.
So, for e.g. if we have following statement or response it will all point to the Interest intent.
- I am interested to know about the product.
- I want to know about the product
- I like to know about the product.
Let us create a new Intent named Greeting and associate 2 utterances Hi and Hello to it.
Once we are done specifying our Intents the next important step is to Train and Test the application.
Select Train and Test and click on Train Application button.
Once the training is completed, we can make use of Interactive Testing interface to do the testing of our utterance and their score.
For e.g. hi utterance had full score i.e. 1 with Greeting intent and 0.19 and 0.13 with the other intent like Interest and None respectively.
Similarly, with “want” utterance we had .77 score for Interest intent.
Next, we test with meeska utterance for which we get the score of .66 with None Intent as this utterance is not associated to any of the intent we had defined nor it is understood by the application.
Now as we are done with testing let us publish it.
Once published, it will provide us with Endpoint URL.
We can append the text to the query string q in the above URL to get the JSON result. (as testing)
Now let us play around with Entity.
Select Entities link and click on Add custom entity button.
Here we are adding an entity named Product.
Now create one more intent that we will associate to this Entity Product named QueryProduct.
Let us add a new utterance, “do you have product1?” and here we will associate the product1 word with the Product entity.
To do so left click on the Product1 word, and select Product from the drop down.
This associates “Do you have [[xyz]]?” with Product entity.
We can quickly test it. Type any utterance like “Do you have x?” and in the result, we can see it being associated to QueryProduct1 intent with full score (1).
Now as we are done with all our configuration, training and testing, we need to train and publish the application again to have all the changes reflected.
In the next post we’d update our bot application to incorporate LUIS AI to it.
Hope it helps..
7 thoughts on “Using LUIS AI in Microsoft Bot Framework – Part 1”