Creating Triggers Based on Language Conditions in Teneo
In Teneo, you can use two different kinds of triggers in your flows, class triggers and syntax triggers. We have already shown some examples of the former one, and will here show you how to create a syntax trigger.
Both class triggers and syntax triggers can be built automatically from learning examples. The difference is that with syntax triggers, a language condition will be created that can later be manually adjusted. This language condition consists of language objects that are concatenated using Teneo’s condition syntax.
We will now build a new flow about Longberry Baristas’ loyalty program, which will have a syntax trigger and allow dialogs like the following:
User: How much does it cost to join the loyalty program?
Bot: You can join the loyalty program for free! Just ask your local barista for a club card and you’re in!
The final result will look like this:
Create a new syntax trigger flow
Let’s start by creating a new flow:
- Below the ‘Flow’ icon in the top ribbon, there is a small black triangle. Click it to open the drop-down menu and select ‘Flow – with Syntax Trigger’.
- Name the flow
User wants to know if loyalty program is free.
- Click the arrow in the top left corner of the window to go to the main flow window.
As you can see the flow contains a syntax trigger instead of a class trigger (if you accidentally created a regular flow with a class trigger, you should add a syntax trigger and remove the class trigger).
Populate the syntax trigger
- Select the syntax trigger and name it
Is the loyalty program free?
- Open the ‘Examples’ panel on the right and paste the following examples in the positive tab:
Is the rewards program free
How much does it cost to join the loyalty program
What is the price of the loyalty program
Do I need to pay for the rewards program
Generate a condition
At this point, you can either force Teneo to generate a language condition, or you can wait until you save the flow and let Teneo generate it then. Let’s force Teneo to generate a condition now:
- Open the ‘Condition’ panel.
- Click on the ‘Now’ button, above the condition field. After a while the following condition will appear:
(%SHOULD_I.PHR &^ %PAY_FOR.VB.MUL &^ %REWARD.NN.LEX &^ %PROGRAM.NN.LEX) / (%WHAT_IS_THE_PRICE_OF.PHR &^ %LOYALTY_PROGRAM.NN.SYN) / (%REWARD.NN.LEX &^ %PROGRAM.NN.LEX &^ %FREE.ADJ.LEX)
As you can see, Teneo used the example inputs to find matching language objects and combine them in a language condition. It is human readable and when you understand the syntax, you can fine-tune it to suit your needs. For now, we’ll just use the condition as is, we will later see how we can further optimize this language condition in order to shorten it and increase its coverage.
If you have also created the User wants to reset the password flow, you may have noticed that the language conditions for transitions are generated in a similar way as syntax triggers.
Add an answer
To finish our flow, we need to add an answer text to the output.
- Select the Answer node and paste
You can join the loyalty program for free! Just ask your local barista for a club card and you're in!into the ‘Answers’ field on the right.
- Name the answer node
You can join the loyalty program for free!.
- Hit ‘Save’.
Try Before You Buy.
Build. Deploy. Analyze.
Sign up to get your own developer sandbox of Teneo containing all the tools needed to build and manage advanced conversational solutions.