$caila.getEntity
Makes a call to Tovie NLP and returns the array of all the values set for the entity.
Syntax
The method accepts the entity name as the string
argument.
- ECMAScript 5
- ECMAScript 6
$caila.getEntity("Name");
In the ECMAScript 6 runtime, the method is asynchronous:
await $caila.getEntity("Name");
A JSON object with the set of values the entity can take is returned.
How to use
Let us look at an example of how entity values can be output. Define a @Yes
entity and specify the reference list of patterns:
[well] [of course|everything|all|seems to |be|possible] (yes|yess|lf|yep|yeah|exactly|aha|correct|ok|ok|o’k|okay|okay|oka|right|confrmd|that’s right) [yes|of course|naturally|sure|everything|all|seems to|be|possible]
Script:
- ECMAScript 5
- ECMAScript 6
state: Example
q!: Yes
script:
$reactions.answer(JSON.stringify($caila.getEntity("Yes")));
state: Example
q!: Yes
scriptEs6:
$reactions.answer(JSON.stringify(await $caila.getEntity("Yes")));
The following JSON object will be returned in response:
{
"id": 460175,
"name": "Yes",
"records": [
{
"id": 28921109,
"values": [
"[well] [of course|everything|all|seems to |be|possible] (yes|yess|lf|yep|yeah|exactly|aha|correct|ok|ok|o’k|okay|okay|oka|right|confrmd|that’s right) [yes|of course|naturally|sure|everything|all|seems to|be|possible]"
]
}
]
}