Sometimes you may not find the language objects you need in the Teneo Lexical Resources, for the simple reason that they do not exist. Teneo Lexical Resources have primarily been designed to cover general language expressions and common phrases, so whenever you want to use more (domain) specific words in your dialog, you may not find existing language objects for them. The good news is that you can easily create missing language objects yourself. Once created, you can use them in your current solution. In fact, you can re-use them in other solutions as well!
On this page, we will create several language objects to recognize various milk alternatives, like soy milk, lactose-free milk, etc. We will then create an entity that makes use of these language objects.
The final list of language objects will look like this:
But first... a bit of theory to explain the difference between 'simple' and 'complex' language objects.
Let's assume that all the coffees served by Longberry Baristas can be ordered in decaffeinated versions. This makes 'decaf' an important concept in our dialogs. It would be useful to have a language object covering it. As the Teneo Lexical Resources do not feature a language object for 'decaf', we will create one ourselves.
To do so, we use the language object button in the 'New' section of the Ribbon and add a name for the language object to be created. Note that this name must be unique in the solution, otherwise Teneo will return an error. It is advantageous to use one of the suffixes if you'd like the new language object to be part of language conditions.
While the example above is very simple, you can also create more complex language objects that make use of other language objects. The complex language object for "soy milk" could look like that:
You can create entities using complex language objects too. Let's create an entity that covers alternatives for milk using complex language objects.
The first step is to create the language objects that should be used by the entity.
Let's start with the example we saw above for soy milk:
%SOY.NN.LEX >> %MILK.NN.LEX.
Repeat these steps to create the following language objects:
LONGBERRY_CONDENSED_MILK.MULwith a condition:
%CONDENSED.ADJ.LEX >> %MILK.NN.LEX
LONGBERRY_LACTOSE_FREE_MILK.MULwith a condition:
%LACTOSE_FREE.ADJ.MUL >> %MILK.NN.LEX
Note that all these new language objects consist of multiple words, and thus bear the suffix "MUL". Because they are specific to our Longberry Baristas project, we decided to add the prefix "LONGBERRY" to each of them. This is common practise because it facilitates the retrieval and maintenance of such project-related language objects. For example, you can easily find them by typing "LONGBERRY_*" in the search interface.
The next step is to create a new entity that uses the language objects we've just created.
LONGBERRY_MILK_ALTERNATIVES(the suffix 'ENTITY' will be added automatically).
|%LONGBERRY_LACTOSE_FREE_MILK.MUL||lactose free milk|
We now have an entity that recognizes the milk alternatives.
Now that we have an entity for milk alternatives, we can extend the 'User wants to order a coffee' flow to take the milk alternatives into account and allow conversations like this:
User: I would like to order a medium flat white with soy milk
Bot: Ok, a medium flat white with soy milk will be ready for pickup in 5 minutes.
But if the user doesn't mention an alternative milk type, we'll asume a regular milk will suffice:
User: Can I order a large flat white
Bot: Ok, a large flat white will be ready for pickup in 5 minutes.
Would you know how to proceed?
Was this page helpful?