Teneo Developers

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.

With the Flow open, follow the below steps to have Teneo Studio generate a draft of the Match implementation:

  • Click the Plus icon following the User Intent either in a trigger or transition

Generate a draft implementation

  • Under Match, click Generate a draft implementation from the Intent examples
  • Alternatively, a draft implementation can be generated by selecting the trigger/transition and clicking Generate in the right-side panel (Match section)

Generate button

  • A Generating... message is displayed in the Match section until the draft is ready; when done the user can of course edit the implementation as needed or add more Matches
  • Remember to Save the Flow to preserve the changes.

Add, edit or delete a Match

Add a Match from the Flow graph

To add a new Match from the Flow editor, follow the below steps:

  • In the Flow editor, below the User Intent node (either in the trigger or transition), click the Plus icon
  • Under Match select one of the following options:
    • match when a given Class is predicted
    • match when a TLML Syntax rule matches the input
    • match when an Entity is recognised in the input
    • match when a Language Object matches the input
    • match when a script returns true
    • match when a Scripted Context state is active
    • match when a Flow Variable matches a given script
    • match when a Global Variable matches a given script
  • In the right-side panel under Match define the specifics for the selected match type
  • Remember to Save the Flow to preserve the changes

Add a Match in the right-side panel

To add a new Match from the right-side panel, follow the below steps

  • In the Flow editor, first select the trigger/transition to open the Trigger or Transition panel
  • In the Match section of the panel, click Add and select the wanted Match type
  • Next, define the specifics for the selected Match type
  • Remember to Save the Flow to preserve the changes

New Matches are inserted at the top of the list; a handle to drag/drop them into the desired order is available in the top-right corner of the Match box.

Edit a Match

  • Select the trigger/transition of the Match
  • In the right-side panel, simply click in the field of the Match to modify the details
  • Remember to Save the Flow to preserve the changes.

Delete a Match

  • Select the trigger/transition of the Match
  • In the right-side panel, click the cross (X) available in the top of the Match's field
  • Remember to Save the Flow to preserve the changes.

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.

Learn more

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.

Learn more

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.

Learn more

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.

When adding a Scripted Context Match in Teneo Studio Desktop, by default, the Context will be assigned with the first expected state available. If the Context has several expected states, the user should choose which to test against by clicking the pencil icon below States and selecting/deselecting the wanted expected states.

Learn more

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.

Learn more