Entities

Entities are a special kind of language object. They cover words which have some characteristic in common. Each entity consists of one or more entries, which denote on what the entity is matching and optionally also which features are assigned to this entry.

Entries

Entities allow for three different kinds of entries:

  1. a word,
  2. a sequence of words,
  3. a different entity,
  4. a different language object.

Internally, a sequence of words will be tranformed 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, for example 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) which 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

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

  • four entries: two other entities (COFFEES_SERVED.ENTITY, TEAS_SERVED.ENTITY), a language object (WATER.NN.LEX) and a set of words ("Chai Latte"),
  • a string variable "temperature",
  • a script variable "beverageType", which is retrieved from the entity variables coffeeType and teaType that are defined in the nested entities COFFEES_SERVED.ENTITY and TEAS_SERVED.ENTITY. For 'water' and 'chai latte' the value of the "beverageType" is given directly as strings.

Different entity variables

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.

Accessing entity variables

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.

Access entity variable from listener condition

Value propagation

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:

  1. All entries of BEVERAGES_SERVED.ENTITY are searched through to match the user input.
  2. A match is found in the language object AMERICANO.NN.LEX of the nested entity COFFEES_SERVED.ENTITY.
  3. The value "americano" of the entity variable coffeeType is propagated up to the entity variable beverageType.
  4. The value of the variable beverageType is accessed via the propagation script in the listener condition and assigned to the flow variable orderedCoffeeType.

Nested entity variables

Was this page helpful?