1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Adding Language Understanding to Chatbots With LUIS



Course Introduction
LUIS Overview & Demo
LUIS Overview
Course Summary
2m 40s

The course is part of this learning path

Start course

This course focuses on how to use the LUIS (Language Understanding Intelligent Service) portal to create new LUIS models, how to enrich them with intents, entities, and utterances, and how to train and apply apps. 

Not only will you get theoretical knowledge of LUIS and its components, but you'll also follow along with demonstrations from the LUIS portal to get a practical understanding of how to use the service.

Learning Objectives

  • Obtain a general understanding of what LUIS is and how to interact with it
  • Create LUIS resources
  • Learn about utterances, intents, and entities and how they are used in language understanding at a practical level
  • Learn how to test, train, and publish your LUIS models

Intended Audience

This course is made for developers or architects who would like to know more about how to use the Language Understanding Intelligent Service, LUIS, to improve their chatbot development and experience.


To get the most out of this course, you should have some Azure experience, particularly surrounding subscription and resource groups as well as chatbots and language services. Some developer experience, including familiarity with terms such as REST API and SDKs, would also be beneficial.


Finally, let's talk about entities. An entity is an item or an element that is relevant, and provides context, to the user's intent. For example, in the sentence, "Book me a table for five people at 6 PM tomorrow," we already know that this will map to the ReserveTable intent. However, this utterance has the answer for the next two next questions the restaurant manager would ask, "What time do you want to reserve," and, "What's the size of the table, for how many people?"

However, not all utterances contain entities. For example, the sentence "How are you doing, chatbot," can be mapped to the greeting intent, but there's no entity, or need for one, in this case. Because utterances might not contain any entity, entities are actually optional on a LUIS model, although you're probably going to need them anyway.

You use entities mainly in two situations. First, you use it when the client application needs the data. For example, if you're creating a pizza ordering bot, the app needs to know the pizza flavor, size or crust type, all of which are entities.

The other situation is when you want to use entities as a feature. In this case, you're using that as a hint to discover the correct intent. For example, if you're building a travel app, you might have options to book cars, flights, and hotel rooms. In this case, the entities car, flight, and hotel will be used as features to help your bot map the request to the correct intents, BookCar, BookFlight, or BookHotel.

This is similar to the concept of phrasal verbs in the English grammar. The expressions get in, get out and get by all have the same verb, but completely different meanings because of the word that follows it. There are five main types of entities in LUIS, List, RegEx, Prebuilt, Pattern.Any and Machine Learned. For the record, there used to be another type called Composite Entity, but this one is now deprecated. Let's see each one of the active ones in more detail.

Let's start with the List Entity. This one represents a fixed, closed set of related words, along with their synonyms. With this entity type, you can use multiple words or variations that point to the same normalized value. For example, you can map the words small, tiny and smallest to a normalized small value that will represent all of them, that could be one of the sizes of your pizza. This entity type is not machine-learned, it is, instead, a case-sensitive, exact match, managed by you. What this means is that the detection will be purely based on the list that you created. For example, if you didn't add the words little or minor to the list, these words will not be mapped to the small normalized value. As you can see, this is a quite trivial entity type, and you should use that when you're working with a small and known set of options that does not change very often.

Now, let's talk about the RegEx, or Regular Expressions entity type. This entity type will understand the entity based on its format. RegEx focuses on a pattern, maybe a combination of letters and numbers, to identify an entity. For example, most credit card numbers will have 16 digits, and most flight numbers will have a combination of two letters and four numbers. Whenever such a pattern appears in a user request, LUIS will map that to the correct entity. Unlike the List Entity type, RegEx entities are not case-sensitive. Regular expressions are best for structured text or predefined sequences of alphanumeric values that are expected in a certain format, such as ZIP codes, credit card information, and flight numbers. It could also be something very specific to your company, such as invoice codes or knowledge base articles. LUIS also has several prebuilt types, so that you don't have to reinvent the wheel on entities that are more commonly used. Because these entities are native to LUIS and already pretrained by Microsoft, you should give preference to them whenever possible.

The prebuilt entity types are culture-dependent, which means that the ones available can vary based to on the language. However, most cultures will have entities such as age, currency, date/time, email, person/name, temperature, URL, and so on. The behavior of these entities is fixed, that means you can use them, but there are no customizations available. That being said, Microsoft allows you to join the open-source GitHub project related to prebuilt entities, so you might have a voice in contributing to it. This is especially valuable if you're working with a culture other than English. For a complete list of all the prebuilt entities available for each culture, you can check this article.

LUIS also has another entity type called Pattern.Any. Whereas the RegEx entities are concerned with the format of the entity, for example, two letters and four numbers for flight codes, Pattern.Any entities are focused on the position of the entity in the sentence. For example, in the sentences, "Can I have a cheeseburger," or, "Can I have a pizza, please," both entities are roughly in the same place, and you can train the model to identify the meal name, pizza or cheeseburger, based on the format of the question. Using this entity type is a good idea when the name of the entity can be easily mixed up with the rest of the utterance. This can be a common occurrence with movie titles or book names. For example, in the sentence, "Is 'Lord of the Rings' available on flight entertainment," you can teach the model that "Lord of the Rings" is the entity, based on its position. If, later on, someone else asks, "Is 'Matrix Reloaded' available on flight entertainment," LUIS will interpret that "Matrix Reloaded" is the entity based on the similar way this question is asked. Keep in mind that this entity might be more laborious to work with.

Finally, LUIS also has machine learned entities. This is the most powerful kind of entity in LUIS, as it allows you to train the model to identify the entity based on the utterances you add. For example, let's suppose that I have created a machine learned entity called Product. Then, I add three utterances. The first one is, "I want to buy a book," and then I mark book as the product entity. The second sentence is, "Can I have the shoes, please," and then I mark shoes as the product. Finally, I add the utterance, "Add this shirt to my basket," and I set shirt as the product. Then I train LUIS, and if I set a fourth utterance, let's say, "A jacket, that's what I want," the service should be smart enough to identify that Jacket is the product. If not, you can review the utterances and make LUIS smarter over time, through active learning, remember?

At first, you might feel tempted to find this similar to the Pattern.Any entity. That's absolutely not the case, though. Notice that the product is in several different positions in the sentences, in the beginning, middle, and end. Machine learned options are much more flexible and powerful than any other entity type, so this is the preferred alternative whenever a prebuilt entity is not available.

Machine learning entities also allow you to create sub-entities, therefore creating complex, hierarchical types. The most classic and illustrative example of this is with flight booking. When you're working on a flight booking application, you're traveling from somewhere to somewhere else, for example, from London to New York. Both of them are location entities, but identifying the from and to is also extremely important, otherwise we will book a flight in the wrong direction.

The way to solve this is by creating a machine learned entity called location, and then two sub-entities called from and to. With this, you'll be able to identify the origin and destination of the flight in the sentence, "Please book me a flight from JFK to London Gatwick."

If you want to know a bit more about entities, here's a couple of links that might help. First, this article in Microsoft Learn is the official study guide for the exam, and contains code samples in both Python and C#. I do recommend you to do the next unit as well, Add Utterances, as it will give you a better understanding of the process. Also, this article on Microsoft Docs covers the concept of entities in much more depth, including the different entity types. The article also has links to a few other pages with additional information and tutorials, if needed.

The last thing that I want to talk about before we jump to our demo is prebuilt domains. As you can imagine, creating LUIS models might be a quite a bit of work. However, some bot applications can be quite simple and straightforward, just as checking the weather or your personal calendar. Therefore, LUIS makes available a set of prebuilt domains that your model can leverage.

Simply put, domains are sets of entities, intents and utterances that are related to a certain topic. The advantage of these domains goes beyond just convenience, as they have been already been trained and test by Microsoft experts on the service.

If you want to know more about prebuilt domains, here's a couple of articles that might help. This article is the official Microsoft Learn page for this topic in the exam. It also talks about prebuilt entities, which we have discussed earlier in this video. Also, a list of all prebuilt domains available can be found in this article from Microsoft Docs.

Now, let's jump into a demo to check how to create utterances, intents, and entities.

About the Author
Emilio Melo

Emilio Melo has been involved in IT projects in over 15 countries, with roles ranging across support, consultancy, teaching, project and department management, and sales—mostly focused on Microsoft software. After 15 years of on-premises experience in infrastructure, data, and collaboration, he became fascinated by Cloud technologies and the incredible transformation potential it brings. His passion outside work is to travel and discover the wonderful things this world has to offer.