Tutorial: Identify common intents and entities

In this tutorial, add prebuilt intents and entities to a Human Resources tutorial app to quickly gain intent prediction and data extraction. You do not need to mark any utterances with prebuilt entities because the entity is detected automatically.

Prebuilt models (domains, intents, and entities) help you build your model quickly.

In this tutorial, you learn how to:

  • Create new app
  • Add prebuilt intents
  • Add prebuilt entities
  • Train
  • Publish
  • Get intents and entities from endpoint

For this article, you can use the free LUIS account in order to author your LUIS application.

Create a new app

  1. Sign in to the LUIS portal with the URL of https://www.luis.ai.

  2. Select Create new app.

    Screenshot of Language Understanding (LUIS) My Apps page

  3. In the pop-up dialog, enter the name HumanResources and keep the default culture, English. Leave the description empty.

    Create LUIS new HumanResources app

  4. Select Done.

Add prebuilt intents to help with common user intentions

LUIS provides several prebuilt intents to help with common user intentions.

  1. Make sure your Human Resources app is in the Build section of LUIS. You can change to this section by selecting Build on the top, right menu bar.

  2. Select Add prebuilt domain intent.

  3. Search for Utilities.

    Screenshot of prebuilt intents dialog with Utilities in the search box

  4. Select the following intents and select Done:

    • Utilities.Cancel

    • Utilities.Confirm

    • Utilities.Help

    • Utilities.StartOver

    • Utilities.Stop

      These intents are helpful to determine where, in the conversation, the user is and what they are asking to do. These intents include usage of entities. These entities are automatically added to the LUIS app: number, ordinal, and Utilities.DirectionalReference.

Add prebuilt entities to help with common data type extraction

LUIS provides several prebuilt entities for common data extraction.

  1. Select Entities from the left navigation menu.

  2. Select Add prebuilt entity button.

  3. Select the following entities from the list of prebuilt entities then select Done:

    • PersonName

    • GeographyV2

      Screenshot of number select in prebuilt entities dialog

      These entities will help you add name and place recognition to your client application.

Add example utterances to the None intent

The client application needs to know if an utterance is not meaningful or appropriate for the application. The None intent is added to each application as part of the creation process to determine if an utterance can't be answered by the client application.

If LUIS returns the None intent for an utterance, your client application can ask if the user wants to end the conversation or give more directions for continuing the conversation.

Caution

Do not leave the None intent empty.

  1. Select Intents from the left panel.

  2. Select the None intent. Add three utterances that your user might enter but are not relevant to your Human Resources app:

    Example utterances
    Barking dogs are annoying
    Order a pizza for me
    Penguins in the ocean

Train the app so the changes to the intent can be tested

  1. In the top right side of the LUIS website, select the Train button.

    Train button

  2. Training is complete when you see the green status bar at the top of the website confirming success.

    Trained status bar

Publish the app so the trained model is queryable from the endpoint

In order to receive a LUIS prediction in a chat bot or other client application, you need to publish the app to the endpoint.

  1. Select Publish in the top right navigation.

    LUIS publish to endpoint button in top right menu

  2. Select the Production slot and the Publish button.

    LUIS publish to endpoint

  3. Publishing is complete when you see the green status bar at the top of the website confirming success.

    LUIS publish to endpoint

  4. Select the endpoints link in the green status bar to go to the Keys and endpoints page. The endpoint URLs are listed at the bottom.

Get intent and entity prediction from endpoint

  1. In the Manage section (top right menu), on the Keys and endpoints page (left menu), select the endpoint URL at the bottom of the page. This action opens another browser tab with the endpoint URL in the address bar.

    The endpoint URL looks like https://<region>.api.cognitive.microsoft.com/luis/v2.0/apps/<appID>?verbose=true&subscription-key=<YOUR_KEY>&<optional-name-value-pairs>&q=<user-utterance-text>.

  2. Go to the end of the URL in the browser address bar and enter I want to cancel my trip to Seattle to see Bob Smith. The last query string parameter is q, the utterance query.

    {
      "query": "I want to cancel my trip to Seattle to see Bob Smith",
      "topScoringIntent": {
        "intent": "Utilities.Cancel",
        "score": 0.807676256
      },
      "intents": [
        {
          "intent": "Utilities.Cancel",
          "score": 0.807676256
        },
        {
          "intent": "Utilities.StartOver",
          "score": 0.0487322025
        },
        {
          "intent": "Utilities.Help",
          "score": 0.0208660364
        },
        {
          "intent": "None",
          "score": 0.008789532
        },
        {
          "intent": "Utilities.Stop",
          "score": 0.006929268
        },
        {
          "intent": "Utilities.Confirm",
          "score": 0.00136293867
        }
      ],
      "entities": [
        {
          "entity": "seattle",
          "type": "builtin.geographyV2.city",
          "startIndex": 28,
          "endIndex": 34
        },
        {
          "entity": "bob smith",
          "type": "builtin.personName",
          "startIndex": 43,
          "endIndex": 51
        }
      ]
    }
    

    The result predicted the Utilities.Cancel intent with 80% confidence and extracted the city and person name data.

Clean up resources

When no longer needed, delete the LUIS app. To do so, select My apps from the top left menu. Select the ellipsis (...) to the right of the app name in the app list, select Delete. On the pop-up dialog Delete app?, select Ok.

Learn more about prebuilt models:

  • Prebuilt domains: these are common domains that reduce overall LUIS app authoring
  • Prebuilt intents: these are the individual intents of the common domains. You can add intents individually instead of adding the entire domain.
  • Prebuilt entities: these are common data types useful to most LUIS apps.

Learn more about working with your LUIS app:

Next steps

By adding prebuilt intents and entities, the client application can determine common user intentions and extract common datatypes.