System entities and directories
English version of the documentation is under development.
Graph already has a set of the most commonly used system directories and entities so that you do not have to create them manually every time. You can use them in the Intents block so that the smartapp extracts a particular entity from the user's phrase and creates a variable with its language-independent value.
System entities enable extracting data that matches specific templates from the user's phrase.
System entities
$TEXT
This entity enables extracting arbitrary text from the user's phrase. However, it can only be used in a template, not in a sample phrase. Switch the quotes to the`@ symbol to use this entity. For example, if the phrases have a template that looks like this
I am lloking for $TEXT
the smartapp will extract the $TEXT
entity with the value "interesting job" from the user's phrase "I'm looking for an interesting job" and create a variable named $TEXT
.
$NUMBER
This entity extracts integers from the user's phrase. The user can specify the phone number either in numbers or in words. As a result, the smartapp will create a variable $NUMBER
and will place an integer in it.
If the user's phrase needs to contain two numbers, use the template instead of sample phrases and rename it as follows
how much is $NUMBER::x plus $NUMBER::y
As a result, after the user pronounces or types the phrase "how much is five plus 25", the smartapp will create two variables $x
and $y
with values 5 and 25, respectively.
$FLOATNUMBER
The same as $NUMBER
, but it enables extracting fractional numbers from the user's phrase. For example, "five point six" or "five point zero six".
$PHONE
Extracts a mobile phone number from the user's phrase. Corresponds to the Phone number block.