Matches
Introduction
A Match is a criterion for matching a user input and can be defined both on triggers and conditional transitions; each trigger/transition can have one or more Matches, of the same type or of different types with the only exception being Classes, where only one is allowed per trigger/transition.
This page provides information about the various Match types and step-by-step guides on how to add, edit or delete a Match in Teneo Studio.
Types
The following Match types are available in Teneo Studio:
- Class
- TLML Syntax
- Entity
- Language Object
- Script
- Context, which covers the following three sub-types:
- Scripted Context
- Flow Variable
- Global Variable
Read more in the Specifics section further below.
Generate
When positive and negative examples of User Intent are added to a trigger or transition, the option to Generate a draft implementation becomes available; this allows to have Teneo generate a draft of the Match implementation based on the available User Intent examples. The user can, of course, always edit or remove the draft or even add further Matches.
Add, edit or delete a Match
Specifics
Multiple Matches
Each trigger and transition can contain as many Match requirements as needed; although only one Class is allowed per trigger/transition.
The matching process
For each user input, the list of Matches is checked top-to-bottom, executing each match requirement against the user input:
- If all Match requirements match, the trigger or transition is considered to trigger for the user input, so the following nodes in the Flow will be executed.
- If any of the Match requirements does not match, the rest of the list is left unevaluated.
Below follows more details on each Match type.
Class
A Class Match matches whenever the user input is classified with the selected class as the TOP_INTENT
. Since Teneo Predict selects a single TOP_INTENT class for each presented input, only one Class Match can be defined per trigger/transition. To define the class, in the Class Match element, simply write the name of the Class which should be used to match.
In Teneo Studio Desktop, when writing the name of an un-existing Class, it is possible to press Ctrl + double-click to open the Class Manager and create the new Class with the specified name.
Note that positive examples of User Intent on a trigger or transition which uses a class as a Class Match are used as Linked Test Examples by the solution's intent classifier.
TLML Syntax
The TLML Syntax Match satisfies inputs based on a syntactic condition written in Teneo Linguistic Modeling Language (TLML) and must be written manually in the Syntax editor.
In Teneo Studio Desktop, just below the Syntax editor, the Advanced Options provide the following two options:
- "Limit unused words to" allows to limit the number of unused words present in the user input by specifying a maximum number of words which the user input may contain besides those matching the TLML syntax for the match to be satisfied; also see Unused Word Limitation
- Use Draft to have Teneo draw up a TLML Syntax based on the User Intent examples in the trigger/transition, the drafted syntax can afterwards manually be adapted and/or expanded as needed and provides a starting point for TLML syntax writing; learn more.
Entity
An Entity Match matches when the selected Entity is present in the user input; to define the Entity, in the Match Entity element simply write the name of the desired Entity.
In Teneo Studio Desktop, when writing the name of an unexisting Entity, pressing Ctrl while double-clicking allows to create an Entity with the written name.
Language Object
The Language Object Match is satisfied if the syntax of the selected Language Object matches the user input; to define the Language Object, in the Match Language Object element simply write the name of the desired Language Object.
In Teneo Studio Desktop, when writing the name of an unexisting Language Object, pressing Ctrl while double-clicking allows to create a Language Object with the written name.
Script
A Script Match matches if the script returns a value that can be interpreted as a True
Boolean value; in Teneo Studio, scripts are written in Groovy.
Script Matches are the slowest among the Match requirements (at evaluation time), so users are encouraged to use them late in the Match chain so their execution is prevented if another Match doesn't match.
To define a script, in the Match Script element, simply write the evaluation script (in Groovy).
Context
The Context Match groups different context conditions that can be matched for an input: Global and Flow Variables and Scripted Contexts.
To define a context, simply write the evaluation script or select the state(s) - depending on the type of Context Match selected.
Scripted Context
A Scripted Context matches whenever the evaluated Scripted Context is one of the selected states; it is possible to add more than one Match Scripted Context to the same trigger/transition.
Flow Variable
A Flow Variable Context matches whenever the value of the selected Flow Variable matches the return value of the expression (evaluation script) in the Match.
Global Variable
A Global Variable Context matches whenever the value of the selected Global Variable matches the return value of the expression (evaluation script) in the Match.