Teneo comes with a collection of pre-built Entities that you may use in your flows. However, sometimes we need to create custom entities for our bot. This is the case for the different kinds of coffee types that are served at Longberry Baristas. In the following section, we will walk you through the creation of this custom entity.
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:
Language Objectsand hit Enter.
Let's create the entity for recognizing the different kinds of coffees that are served at Longberry baristas. In Teneo, an entity can either contain words, phrases or language objects. Generally speaking, language objects are usually lists of synonyms or thematically related words, which are used to recognize the wide variety of user inputs. This means that language objects ensure a broader coverage, including the plural forms, declinations, and synonyms of the words compared to just using words or phrases. In other words, we do not have to specify every form or synonym of a word to get great coverage. For example, the language object '%AMERICANO.NN.LEX' will not only recognize "Americano", but also the plural form "Americanos".
The entity that we are creating in this section will contain both language objects and words like brewed coffee (singular) and brewed coffees (plural). Since no language object covers the different forms of ‘brewed coffee’ we have to specify them ourselves in the entity. It would be a good idea to create a language object that covers both singular and plural forms of ‘brewed coffee’, and then use that language object as an entry in the entity instead. However, we will skip this step for now...
This is how we go about it:
COFFEES_SERVED(the type .ENTITY is automatically defined).
|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'.
As you can see the entity structure is similar to a spreadsheet as it contains columns and rows. The left column contains entry values like language objects and words. In the right column, we have the variable 'coffeeType' which contains the string value of the entry on the corresponding row. For example, if we recognize 'americano' the variable 'coffeeType' would get the value "americano". You will learn more about how to extract data from user input on the next page.
The language objects used in the entity above are of the type lexical entries, which are the smallest building blocks from which more complex language objects can be built. All language objects have a suffix that denotes which type it is. On this page, we have worked with lexical entries which have the suffix ‘.LEX’. Language objects of the type lexical entries usually contain different inflections, regional variations, and spelling of a word.
Great job! You have just created your first custom entity and worked with these components:
Now that we have added an entity that stores coffee types. Let us proceed with adding one more entity but this time for the following coffee sizes:
We have finally created an entity that stores different coffee types. Now its time to use this entity inside the flow and extract the values.
Was this page helpful?