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 Intents. 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 Intents 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.

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

  • After the User Intent, click the Plus icon

Generate a draft implementation

  • Under Match, click Generate a draft implementation from the Intent examples
  • Teneo Studio displays a new Match node with the message Generating match requirement..., when finished the new Match is displayed. The user can edit the implementation as wanted and also add more Matches as needed
  • 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 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.

To add, edit or delete a Match follow the below steps:

Add a Match

In the Flow editor, when

  • no Match is implemented: below the User Intent, click the Plus icon, and under Match select between the below listed options
  • one or more Matches are implemented: in an existing Match click Add match requirement to choose between the below listed options
    • match when a given Class is predicted for the input and select the wanted Class in the list
    • match when an Entity is recognized in the input and select the wanted Entity in the list; start writing the name of the wanted Entity to filter the list by Entity name
    • match when a Language Object matches the input and select the wanted Language Object in the list; start writing the name of the wanted Language Object to filter the list by Language Object name
    • match when a TLML Syntax rule matches the input (TLML Syntax Match) and write the syntax in the text box
    • match when a Scripted Context state is active (Scripted Context Match); select the wanted Scripted Context and assign the state(s)
    • match when a Flow Variable matches a given script (Flow Variable Match); select the wanted Flow Variable and write the evaluation script
    • match when a Global Variable matches a given script (Global Variable Match); select the wanted Global Variable and write the evaluation script
    • match when a Script returns true (Script Match); write the evaluation script
  • Remember to Save the Flow to preserve the changes.

When adding a Match Language Object or Entity, the initially displayed list of suggestions (before writing anything in the text field) contains a list of the 20 most recently added or modified Language Objects/Entities.

Edit a Match

  • Select the Match node in the Flow
  • Edit the wanted details
  • Remember to Save the Flow to preserve the changes.

Delete a Match

  • Go to the Match node in the Flow
  • In the node, click the vertical dots and select Delete node
  • 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 the Machine Learning model selects a single TOP_INTENT class for each input, only one Class Match can be defined per trigger/transition.

To define the class, in the Match Class element, simply write the name of the Class which should be used to match.
In Teneo Studio Desktop, when writing the name of an unexisting Class, it is possible to press Ctrl + double-click to open the Class Manager and create the new Class with the specified name.

Learn more

TLML Syntax

The TLML Syntax Match satisfies inputs based on a syntactic condition written in Teneo Linguistic Modeling Language (TLML).
The syntax is written manually in the Syntax editor; in Teneo Studio Desktop the developer can draft a syntax based on the provided User Intents, the drafted syntax can be adapted as needed afterwards (in the Match TLML Syntax element, click Advanced Options > Draft).

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

When adding a Scripted Context Match in Teneo Studio Web, the user must first select the wanted Scripted Context in the drop-down menu and next select the wanted state(s); if the Context has several expected states defined, the user can add more than one state by opening the States drop-down menu again and selecting another. Note that only unassigned states are available in the drop-down menu.

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