Share via


Azure Cognitive services: Getting Started With Natural Language Understanding (LUIS)

 

Introduction

Language Understanding Service (LUIS) allows an application to understand what a person wants in their own words. LUIS can integrate to 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 wiki, we will show how to build a new app on the LUIS portal.

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, we need to create the basic parts of an app, intents, and entities. Then, we test the app by providing a sample user utterance in the interactive test panel to get the predicted intent.

Create LUIS App

Step 1 : Navigate to LUIS Portal in a browser and sign in. If you are trying to signing in the first time, you need to create a free LUIS account.
Step 2 : Click on “Create New App” from the portal menu options.

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.

Once completed, click the "Done" button and select “Build” menu from the main menu.

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.

  • New Intent – you can create a custom intent based on user needs
  • 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".

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.

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.

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 Prebuilt domain entry.


In order to train the model, you’ll see a "Train" button on the top-right corner.


Now, you can start publishing your LUIS application.

While publishing an application, it will be available for multiple environments. Let us start with the “Production” environment and publish.

After publishing, it's available publicly in the endpoint URL.

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.


When your model is trained and up-to-date, you can then open the test panel and provide some utterances to your LUIS model.

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.

Summary 

In this wiki, 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.

Additional Resources