Natural language understanding 101

Learn basic natural language understanding terminology

There are different platforms available to create a natural language understanding applications. Among them are wit.ai, api.ai, luis.ai, WatsonConversations to list a few. They all are practically doing the same thing — let you easily handle conversations. You send a user query via an API they provide and get a response ready to send back to your user. They appeared almost at the same time, that’s why they have a lot of similar features.

Agent

It’s called agent by api.ai, app by wit.ai and luis.ai and workspace by WatsonConversations. This is the first thing you create, here you store all your the data we talk about below.

Intent

wit.ai calls it understanding

Intent is an instance where you store all utterances of one kind. For example, you want your application to understand requests to turn on the light. First, you’ll need to create an intent and there you put all phrases similar to ‘turn on the light’, such as ‘light on’, ‘switch on the light’, ‘can you please turn the light on’ and so on.

Organizing intents is a very challenging and creative work. If you plan to create a sophisticated application to understand a lot of requests, you should take time designing your intent schema first. If you don’t, it may go out of control easily as long as it grows.


Entity

Entity is a variable part of an utterance.

‘I would like to order a [cappuccino, espresso, tea, milk] usually is replaced by ‘I would like to order a [DRINK]’, where [DRINK] is a custom list or an entity. All platforms offer system entities, these are prebuilt lists made by developers that you can use out of the box. These usually are date, time, numbers, phone numbers, emails, zip codes and similar lists. The problem with them is, it’s a black box, you can’t look inside, edit or extend it.

There are also compound entities in some platforms. This is an entity which consists of entities :)


Slots

Slots are very useful to create dialogs. For example, you want voice-enable your smart home application. The user can ask your app: ‘Change light color’. This request is incomplete as long as you don’t get information about the color itself. Your app needs to prompt a question: ‘What color?’. This is called slot filling. You basically fill missing slots. As soon as all required information is gathered, you can move on with the conversation.


Context

Context management is required to create a meaningful conversation. Contexts are used to link phrases together, to store user’s data. It is similar to sessions in web development. Context makes machine sound more human. Compare two dialogs with context.

‘And in the living room’ is interpreted differently in the second dialog, because of the context.

User: Turn on the light in the kitchen. 
App: Light is on.
User: And in the living room. 
App: Done.

User: Turn off the light in the kitchen. 
App: Light is off.
User: And in the living room. 
App: Done.


This article only scratches the surface of natural language understanding. If you want to learn more, the best way is to create your first app right away!

Questions? Hit me a message on Facebook.