entity
This block captures an NLP entity regardless of the incoming message intention.
entity(name=String, &block)
entity(name=String, &block)
Configuration
The NLP engine must be enabled and configured in bot/config/nlp.rb
file in order to implement this block.
Platforms
Messenger
Telegram
Usage
For this example, we will use the entity wit$datetime:datetime
(Wit.ai Built-In)
And suppose the following message arrives:
"tomorrow at 7am"
As you can see in this message, there is no clear intention. But implementing this block, where we send a reply with two options, we can try to understand the message intention.
Custom entities
To further understand how entities work, we will create in Wit.ai an entity called colors
where we will train the NLP engine with various color options.
The entity can be created and trained directly from the Wit.ai Dashboard or via API for which Kogno has a method.
Create a custom entity
On the project's directory, open the console by running the kogno c
command and then execute the following:
This will create the color
entity with the role name
.
Usage
In the following example, MainContext
will catch any incoming messages such as: "I want a blue t-shirt", "grass is green" and so on.
Last updated