Entities are a special kind of language object. They cover words that have some characteristics in common. Each entity consists of one or more entries, which denote what the entity is matching and optionally also which features are assigned to this entry.
For your bot to understand what the user said, some words of the user's utterance are more important than others. Typical examples for such important words include so-called named entities like cities or product names.
One way of catching these is using entities.
Each entity covers a collection of one or more words called 'entries', which all have some characteristic in common. For example, these all denote cities in the Netherlands:
To enhance natural understanding, the entries can have variables carrying additional information about each entry. For example, different names may denote the same city, like "Den Haag" and "The Hague". With variables, it is possible to map these different variants to the same city name. Another example is the code of the nearest airport, which is useful to have in-flight booking scenarios.
In the entity examples above, all entries are strings. It is also possible to have entities added as scripts where one example can be found in LUIS^Teneo. Note that entries may also consist of other entities or language objects.
In order to use the entity covering the cities of the Netherlands in your flow, simply add
%CITIES_NETHERLANDS.ENTITY to your language condition.
The variables sCity and sAirportCode can be accessed using attached scripts and data actions.
Teneo comes with a collection of pre-built entities that are ready to be used. Some of them have been machine-learned, like geographical entities like cities or addresses, while others have been hand-crafted, like a list of colors. A full list of available entities can be found here.
Entities allow for three different kinds of entries:
Internally, a sequence of words will be transformed into Teneo's condition syntax. For example, if the two words "Chai latte" are entered into the entry field of an entity, they will be interpreted as Chai>>latte which means that the word "Chai" is directly followed by the word "latte" without any intervening word allowed in between them. However, this holds only for sequences of strings. For any other combination of entries, e.g. sequences containing entities or language objects this is not possible. If you want to add such a sequence (for example HOT.ADJ.LEX WATER.NN.LEX) to an entity you will have to create a new language object (here: HOT_WATER.ADJNN.MUL) that contains the sequence of these two language objects in its language condition. This multiword language object can then be added to be an entry of the entity BEVERAGES_SERVED.ENTITY.
Entity variables can be used to add properties to the different entries of an entity. There are two variable types: strings and scripts. The variable type can be determined using the toggle below the variable name. An example is given below. The customized entity BEVERAGES_SERVED.ENTITY contains all kinds of beverages served at Longberry Baristas. Its consist of
As you can see, a string variable can only contain strings, whereas a script variable can contain script expressions or strings. However, if you add strings to a script variable, make sure to add quotes around them.
In the example below we attached a propagation script to an entity in a listener condition. The flow variable orderedBeverage is assigned lob.beverageType. This lob is a special variable which points to the entity (or, more generally speaking the language object, hence lob) to which the script has been attached to, BEVERAGES_SERVED.ENTITY, and retrieves the value of the entity's variable beverageType.
So for example, if the user input is 'I want an Americano', then the value 'americano' will be assigned to the flow variable orderedBeverage.
What happens is the following:
Was this page helpful?