Create custom entities

Teneo comes with a collection of pre-built Entities that you may use in your flows. However, sometimes we may need to create custom entities for our bot. For example, this is the case for coffee sizes and different kinds of coffee types that are served at Longberry Baristas. We will in the following walk you through the creation of these two.

Create a 'Language Objects' folder

Before we create our entities, it might be a good idea to create a folder that we can use to store them. This is not required, but as a solution grows, folders help to structure your Teneo assets. To create the folder, proceed as follows:

  1. Make sure none of the folders on the left are selected, by clicking in the white area below the folders in the 'Explore' section.
  2. Click the 'Folder' icon in the 'New' group in the Ribbon.
  3. Give your folder a name, for example Language Objects and hit Enter.

Coffee Sizes

Let's create the entity for coffee sizes. In Teneo, an entity can either contain words, phrases or language objects. For simplicity, we start with words here. Moreover, we add a variable called size which can be used to map different names of the same size to the same internal representation. For example, both "medium" and "regular" will result in a "medium" sized coffee at Longberry Baristas.

This is how we go about:

  1. In your main solution window, select the 'Language Objects' folder and click 'Entity' in the 'New' section of the Ribbon. This will create a new entity in the selected folder.
  2. Call the entity COFFEE_SIZES (the type .ENTITY is automatically defined).
  3. Use the left arrow on the top to get to the HOME tab of the entity.
  4. Copy the following table onto the clipboard:

    Coffee size coffeeSize
    small small
    medium medium
    regular medium
    large large
    big large
    supersize large
  5. In the Home window of the Entity, select the field Click here to add a new entry.
  6. While the Entity field is marked, use ctrl+V to paste the table into the Entity.
  7. You will now be asked whether the first row of the table you are about to paste contains variable names or belongs to the data set. Select 'First row is variable names'.
  8. Hit 'Save' and close the entity window.

Coffees Served

Now that we have the coffee sizes in place, it is time to add an entity to recognize the different kinds of coffees that are served at Longberry Baristas. In addition to words, this entity will also contain phrases and language objects. The usage of language objects ensures a broader coverage with respect to plural forms, declinations and synonyms of the words. For example, %AMERICANO.NN.LEX will not only recognize "Americano", but also the plural form "Americanos".

Let's go ahead an create the entity:

  1. In your main solution window, go to the 'New' section of the top ribbon an select 'Entity'. This will create a new entity.
  2. Call the entity COFFEES_SERVED (the type .ENTITY is automatically defined).
  3. Use the left arrow on the top to get to the HOME tab of the entity.
  4. Copy the following table onto the clipboard:

    Coffee name coffeeType
    %AMERICANO.NN.LEX americano
    %CAPPUCCINO.NN.LEX cappuccino
    %CORTADO.NN.LEX cortado
    %ESPRESSO.NN.LEX espresso
    %FRAPPUCCINO.NN.LEX frappuccino
    %LATTE.NN.LEX latte
    %LUNGO.NN.LEX lungo
    %MACCHIATO.NN.LEX macchiato
    %RISTRETTO.NN.LEX ristretto
    flat white flat white
    flat whites flat white
    brewed coffee brewed coffee
    brewed coffees brewed coffee
    filtered coffee brewed coffee
    filtered coffees brewed coffee

    Note that filter coffee and brewed coffee are considered synonyms and both should return the type 'brewed coffee'.

  5. In the Home window of the Entity mark the field Click here to add a new entry.
  6. While the Entity field is marked, use ctrl+V to paste the table into the Entity.
  7. You will now be asked whether the first row of the table you are about to paste contains variable names or belongs to the data. Select 'First row is variable names'
  8. Hit 'Save' and close the entity window.

Was this page helpful?