Getting Started With Natural Language Understanding with LUIS

Introduction

 
Language Understanding Service (LUIS) allows an application to understand what a person wants in their own words. LUIS can integrate into Windows, Web, Bot, and mobile applications, which can consume a JSON response to the application. LUIS uses machine learning to allow developers to build applications that can receive user input in natural language and extract meaning from the user input.
 
Building an app is free and doesn't require an Azure subscription. In this article, I will show how to build a new app on the LUIS portal.
 
Getting Started Natural Language Understanding with LUIS
 
Once the LUIS app is published, a client application sends utterances (text) to the LUIS natural language processing endpoint API and receives the results as JSON responses. First, you need to create the basic parts of an app, intents, and entities. Then, you test the app by providing a sample user utterance in the interactive test panel to get the predicted intent.
 
Getting Started Natural Language Understanding with LUIS
 

Create LUIS App

 
Step 1
 
Navigate to LUIS Portal in a browser and sign in. If you are trying to signing for the first time, you need to create a free LUIS account.
 
Step 2
 
Click on “Create New App” from the portal menu options.
 
Getting Started Natural Language Understanding with LUIS
 
Step 3
 
Provide name, culture, and description in the following information into the new app screen.
  • Name - provide the relevant to your application and a unique LUIS app name.
  • Culture – LUIS will support multiple languages. For now, we will select the English language.
  • Description - Provide a description of the app; however, it is an optional field.
Getting Started Natural Language Understanding with LUIS
 
Once completed, click the "Done" button and select the “Build” menu from the main menu.
 
Getting Started Natural Language Understanding with LUIS

Create Intents

 
Intent is an action the user wants to perform. Natural language is extremely flexible. In fact, different languages and cultures make them less or more flexible. But what is the user’s "intention?" It’s the goal the user is trying to achieve. Maybe they want to turn the lights on. Maybe they want to schedule a calendar appointment. Maybe they want to send an email. Whatever the intent may be, the user can express themselves in a multitude of ways, but it always translates to one intent. LUIS understands utterances and converts them into one or more intents that you specify in your LUIS application. There are two types of intent.
  1. New Intent – you can create a custom intent based on user needs
  2. Add prebuild domain Intent - you can use prebuilt intents from one of the prebuilt domains.
Select Intents > click on "New intent" or "Add prebuilt domain intent".
 
Getting Started Natural Language Understanding with LUIS
 
Prebuilt domain intents are parts of prebuilt domains. You can select the inbuilt category and intents from the list. Here, we will select sending an email and send email prebuilt domain intents.
 
Getting Started Natural Language Understanding with LUIS
 

Create Entities

 
When the user issues a command as an utterance, that utterance is converted into an intent. But hidden inside that utterance is important data that is needed to complete the action. For example, "turn the lights off" represents an action called "off;" what entity is it working on? It’s working on lights. You need to extract a single entity out of this utterance.
 
Select Entities > Add the Prebuild domain entity.
 
Getting Started Natural Language Understanding with LUIS
 
LUIS comes with a number of prebuilt domain models with prebuilt entities. Or, you can quite easily create a new custom domain model with custom entities. Here, we are creating a Prebuilt domain entry.
 
Getting Started Natural Language Understanding with LUIS
 
In order to train the model, you’ll see a "Train" button on the top-right corner.
 
Getting Started Natural Language Understanding with LUIS
 
Now, you can start publishing your LUIS application.
 
Getting Started Natural Language Understanding with LUIS
 
While publishing an application, it will be available for multiple environments. Let us start with the “Production” environment and publish it.
 
Getting Started Natural Language Understanding with LUIS
 
After publishing, it's available publicly in the endpoint URL.
 
Getting Started Natural Language Understanding with LUIS
 
Here, you can view your publish settings, as well as your LUIS App ID and Password. You will need these to access your LUIS app from your client applications. Please note that you can also type in queries directly to your production endpoint, and you’ll get a JSON response from LUIS.
 
Getting Started Natural Language Understanding with LUIS
 
When your model is trained and up-to-date, you can then open the test panel and provide some utterances to your LUIS model.
 
Getting Started Natural Language Understanding with LUIS
 
You can copy-paste the URL highlighted in the key Endpoint setting screen and under the endpoint column (note that the app ID and keys are removed for this image) into an internet browser, and type the query – “Please email to Suthahar”. Below is the full JSON response for the query.
 
Getting Started Natural Language Understanding with LUIS
 

Summary

In this article, you learned about how to create Natural Language Understanding app with LUIS. If you have any questions/ feedback/ issues, please write them in the comment box.


Similar Articles