Getting started with Luis.ai

Spread the love

Language Understanding Intelligence Service (LUIS) allows your application to understand what a person wants in their own words. LUIS uses machine learning to help build applications that can receive user input in natural language and extract meaning from it.

A LUIS app is a domain-specific language model you design to your application needs. A model starts with a list of general user intentions such as “Book Flight” or “Contact Help Desk.” Once the intentions are identified, you supply example phrases called utterances for the intents. Then you label the utterances with any specific details you want LUIS to pull out of the utterance.

Luis has also prebuilt domain models include all these pieces for you and are a great way to start using LUIS quickly.

After the model is designed, trained, and published, it is ready to receive and process utterances. The LUIS app receives the utterance as an HTTP request and responds with extracted user intentions. Your client application sends the utterance and receives LUIS’s evaluation as a JSON object. Then its up to you to use the results in your application.

In this quickstart, we will use an example file to create a Luis application. When you’re finished, you’ll have a LUIS endpoint running in the cloud.

For this article, you need a free LUIS account in order to author your LUIS application.

Luis Terms

  • Intents An intent represents actions the user wants to perform. The intent is a purpose or goal expressed in a user’s input, such as booking a flight, paying a bill, or finding a news article. You define and name intents that correspond to these actions. A travel app may define an intent named “BookFlight.”
  • Utterances An utterance is text input from the user that your app needs to understand. It may be a sentence, like “Book a ticket to Athens”, or a fragment of a sentence, like “Booking” or “Athens flight.” Utterances aren’t always well-formed, and there can be many utterance variations for a particular intent.
  • Entities An entity represents detailed information that is relevant in the utterance. For example, in the utterance “Book a ticket to Athens”, “Athens” is a location. By recognizing and labeling the entities that are mentioned in the user’s utterance, LUIS helps you choose the specific action to take to answer a user’s request.

Prerequisites

Step 1: Create the Luis application

Download this json file. Open the luis.ai portal. If it is the first time using the luis.ai portal choose your country.luis

Choose Import New App.

Choose the file you just downloaded, type a new name of you want or just choose Done.

Step 2: Create the model

Open the application you just created and see the created intents.

You can see three Intents created. This is the action that luis will return to your application based on the context. This a sample model. These here are utterances that the user uses to describe what they want. Each phrase has one or more entities (words in blue).

luis

Luis supports prebuilt entities, such as numbers, locations, money, temperature etc.

entities

To add an entity click on any word on your utterance and choose from the list. Also you can create your own entity.

In the entities tab you can see all the entities your application uses

entities

Step 3: Improve the performance and accuracy of your results

As soon as you create/edit your intents you can use Phrase Lists and Patterns to improve the accuracy of your results.

phrase lists

You can create a phrase list for words that are interchangeable in a sentence. Use the values you want. Luis uses the Bing APIs to gives you recommendations as well.

list

Also you can declare patterns of things your users usually say. Under the Patterns tab you can add new text patterns.Your patterns can have optional words declared with simple brackets [ ]. If you want to use your entities declare the with curly brackets { }.

Step 4: Train and test your model

After you are done creating your model click the Train button next to Settings. The button dot should change to green. After training you can use the test button to test the results. There are 2 ways to test the results. First you can type a sentence and see the result.

After training you can use the test button to test the results. There are 2 ways to test the results. First you can type a sentence and see the result. Click the Inspect button to see the details.

You can also test the application using batch testing. Click the Batch Testing Panel link on top. Then import your dataset.

The dataset must be a json file in the following format

[
    {
        "text": "hey dad, are you hungry?",
        "intent": "None",
        "entities":
        [
            {
                "entity": "FamilyMember",
                "startPos": 4,
                "endPos": 6
            }
        ]
    },
    {
       ...
    }
]

Step 5: Publish your model

As soon as you completed all the above steps go to the publish tab in the menu, you can choose to publish either to Staging or Production.

Your application is ready. To hit your Luis application endpoint use the following endpoint and key. To create a new Key you must first create it in the Azure Portal and then add it here.

Leave a Reply

Your email address will not be published. Required fields are marked *