Benefits to using LUIS
One of the key problems in human-computer interactions is the ability of the computer to understand what a person wants, and to find the pieces of information that are relevant to their intent. For example, in a travel agent app, you might say "Book me a ticket to Paris" in which case there is the intention to "BookTicket" while "Paris" is the location entity. Intention can be defined as the desired action and usually contains a verb, in this case "book", and the entity is the topic/subject, in this case "Paris", of the action.
Using LUIS for the first time
Creating your first LUIS application
Step 1: Creating an application
Step 2: Adding intents, entities and labelsNext, we will add two intents to the application. At the top left of the menu panel, you will see an area for intents. All applications come with one pre-defined intent, None. This will recognize user statements that have nothing to do with the application, for example if someone says "Get me a great cookie recipe". Go ahead and click + next to Intents on the horizontal bar. You'll see a dialog box appear to add a new intent. Enter the intent name of "BookFlight", and the example command that triggers the intent as "Book flight to Paris". This will look like the screenshot below.
Click Save, and the utterance will be presented for labeling. The intent "BookFlight" (just click on it) will be highlighted, and you will see a drop-down with the entities you've defined. Click Submit to submit the utterance to your LUIS app.
- In the Application Editor workspace, find Entities in the left-hand menu panel, then click the + sign.
- In the Add a new Entity dialog box, type "Location" as the entity name.
- Click the plus sign next to the Entity Children.
- In the text box that appears, type the name of the first child, "ToLocation".
- Click the plus sign again to add the second child, “FromLocation”, and so on.
- To delete a child, if you made a mistake, click the trash can sign next to the entity child.
- When finished, click "Save".
Step 3: Seeding the system by labeling utterances
Step 4: TrainingWhen you "train" a model, LUIS generalizes from the examples you have labeled, and develops code to recognize the relevant intents and entities in the future. Internally, LUIS uses logistic regression classifiers to determine intents, and conditional random fields (CRFs) to determine the entities. The training process results in optimized classifiers and CRFs, referred to as models, that LUIS can use in the future. To do training, just click the Train button at the left bottom corner of the page. Training also occurs automatically with regular intervals.
Step 5: Publishing a modelThe next step is to deploy the model to an HTTP endpoint that will interpret the sentences we send it. Click the Publish button in the upper left-hand corner, and then Publish web service in the resulting window. After a couple of moments, you will see a url that makes your model available as a web service. LUIS will look like the below screenshot. To acquire a subscription key, see Creating Subscription Keys Via Azure Ibiza.
Understanding the JSON response
- Set the URL parameter to be your query/utterance, for example, "Book me a flight to Boston on May 4", then click Update published application..
- Hit the Enter key or click on the generated URL in the dialog box.
|Field||Json type||Description of content in example|
|Query||string||Query/utterance: "Book me a flight to Boston on May 4"|
|Intents||object||All intents listed (each with their highest score): "BookFlight", "None", "GetWeather"|
|Score||number||Confidence score, between 0 and 1. Only the highest score is listed for each intent.|
|Entities||object||"boston", Type: Location::ToLocation (parent::child). "may 4", Type: builtin.datetime.date|
|Score||number||Confidence score, between 0 and 1. Only the highest score is listed for each entity.|
Oh right, we are good but we are not done yetOn our part 2 we gonna continue by creating our Bot Connector using Microsoft Bot Framework,
SummaryYou have now built a basic LUIS application. This application can be enhanced by adding more advanced features.
Original Author: Winston Gubantes