About natural language understanding (NLU)

Depending on your bot, you may be able to use natural language understanding to improve the performance of your bot by:

  • Training it to identify the correct intention from the message.
  • Training it to identify key words (entities) in the message in order to select the next best interaction for the conversation.
  • Reducing the number of times the default message is sent to users.

Training a bot in this way means that you do not need to manually enter all the possible utterances for an intention.

Example intention

Consider the example of a dining intention. Users might send messages (utterances) similar to these:

where's a good chinese restaurant
i want a burger 
show me pizza places 

These are examples of places to eat. In order to respond correctly to these messages, a bot needs to match the messages sent by users to the dining intention. To improve the accuracy of the matches, Converse uses entities.

Example entity

To improve the accuracy of the matching process, the bot uses entities to extract specific values from utterances. In the above example, the entity representing places to eat might be restaurant. For each entity, you set up at least one example, such as:
  • restaurant
  • chinese
  • takeaway
  • pizza

For alternative examples, or more specific examples of a general example, you add synonyms. For the takeaway example, synonyms might be: takeout, drive thru. Synonyms are optional.

Entities are separate from intentions and can therefore be used by any intention.

Note: At this release, Converse only matches on one of the entities in an utterance. So for the utterance where's a good chinese restaurant in the center, the bot will match on either the restaurant entity or the location entity (if center is an example of a location).

Training the bot to use the example intention

To train the bot to identify the intention and its keywords, you need to set up sample utterances for the intention as training data.

Examples of utterances for training a dining intention might be:

i'm looking for somewhere to eat 
i want a place for lunch 
good place for dinner 
show me chinese restaurants 
find me an indian takeaway 

Guidelines on writing utterances for NLU explains what you should include in the utterances.

Accessing the entity value in the utterance

You can access the entity value in an utterance in the same way that you access other variables in Converse:

Where used Example
In messages sent to users, enclose the entity in curly brackets. {restaurant}
In an Action interaction, access the data through the context object. context.restaurant

Setting up intentions to use NLU