Part of the Botpress NLU (Natural Language Understanding)
The second tab of the Explorer panel is the Library. Here you will find your global Intents and Entities. In addition to global Intents, Botpress provides Inline Intents that can be defined on a Transition.
Recognizing the meaning of user messages is essential. It’s critical not only to identify them, but also accurately classify them. To do so, you can program your chatbot to extract information from a natural conversation (i.e. a conversation with a human).
When you create an intent, you also add utterances. Utterances represent the different statements your user can use to say or ask for the same thing.
You can also use them as inline intents for transitions.
For example, we can add the following utterances to the “Ordering a coffee” intent:
- I want coffee
- I'd like some coffee, please
- Do you have a decaf espresso?
- Hi. I'd like to order a latte, please. Normal, single shot.
You can add these different utterances to train your chatbot to answer an intent instead of a specific word. The user statements are compared and matched with the most appropriate intent with the highest confidence score.
|User Message||Intent Matched||Confidence|
|I would like to order a coffee.||place-order||0.97|
|An espresso, please||place-order||0.91|
|Can you please give me a double cappuccino?||place-order||0.96|
To create a new intent,
- In your Conversation Studio, click the Library tab from the top left corner.
- Click the + button.
- Give it a friendly name.
- Click Submit.
- Write your utterances next to the number (where you can see type a sentence).
Utterances currently have a maximum of 280 characters.
You can think of Entities as intent parameters. They represent a concept such as a colour, a date, a time, or a weight. Entity extraction helps you extract and normalize desired entities if they are present in a user phrase or message to the chatbot.
Example: The place-order intent contains the following entities: caffeine that specifies if the coffee is caffeinated or decaffeinated. size for a single or a double shot. drink that specifies the kind of drink asked. Attached to NLU extraction, you will find an entities property which is an array of System and Custom entities.
Botpress provides two types of custom entities: pattern and list entities. To define a custom entity, go to the Library tab of the Explorer. From there, you can define your custom entities which will be available for any input message treated by your chatbot. Go ahead and click on New entity.
You may access and use entity data by looking up the event.nlu.entities variable in your hooks, flow transitions or Execute Code cards.
List extraction behaves similarly to pattern extraction. However, you'll be able to add different occurrences of your entity with corresponding synonyms. Let's take Airport Codes as an example: Extraction will go like this: User said Type Value "Find a flight from SFO to Mumbai" "Airport Codes" ["SFO", "BOM"]
Pattern or Regular Expression Extraction allows you to extract information presented in a format that can be described using Regular Expression (RegEx). Once you've created a pattern entity, Botpress Native NLU will perform a regex extraction on each incoming message and add it to event.nlu.entities. Example: Given a Pattern Entity definition with [A-Z]3-[0-9]4-[A-Z]3 as a pattern: Extraction will go like this: User said Type Value Find product BHZ-1234-UYT SKU BHZ-1234-UYT