Teneo Developers

After Matches

Introduction

After Matches are actions which are executed and evaluated only after the trigger or transition has been triggered; this page provides information related to the various After Match actions available in Teneo Studio, including step-by-step guides on how to add, edit or delete an action.

Types

The following After Match types are available in Teneo Studio:

  • Entity
  • Language Object
  • Listener
  • Script

Read more in the Specifics section further below.

Add an After Match

To add an After Match action in Teneo Studio Desktop, follow the below steps:

  • In the Flow editor, click the Plus icon where information should be extracted or a script executed or alternatively, select the trigger or transition where the After Match action should be added, and click Add in the After Match section of the right-side panel
  • In the After Match group, choose one of the following:
    • extract the value of a Language Object variable (if it matches the input) (Language Object)
    • execute a script when the input matches an additional TLML Syntax rule (Listener)
    • extract the value of an Entity variable (if present in the input) (Entity)
    • store the words which matched as a variable/execute a script (Script)
  • After selecting one, the right side panel is opened, and the After Match section marked with TODO
  • Now, define the specifics of the selected After Match:
    • Write the name of the Language Object After Match, Add Mapping if applicable
    • Write the TLML Syntax (in Teneo Linguistic Modeling Language) and the Execution Script (Groovy) of the Listener
      • In the Advanced Options, adjust the following settings as needed:
        • Test sentence from: Last to first or First to last
        • Limit unused words to: select numeric value
        • Stop after: All sentences tested, First match or Current sentence tested
    • Write the name of the Entity After Match, Add Mapping if applicable
    • Write the Execution Script (in Groovy) of the Script After Match
  • Remember to Save the Flow to preserve the changes.

New After 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 After Match section.

Edit an After Match

To edit an existing After Match follow the below steps:

  • Select the trigger or transition where the After Match is defined
  • In the right-side panel, modify the needed details in the After Match section
  • Remember to Save the Flow to preserve the changes.

Delete an After Match

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

Specifics

Multiple After Matches

Each User Intent trigger and transition can contain as many After Matches as needed.

The matching process

Where Matches are used to determine when a User Intent trigger should trigger, the After Matches are those actions which are executed whenever the User Intent trigger is triggered by a user input, so any Match(es) need to match before the After Match actions are evaluated.
As with Matches, the After Matches are executed in the same order as they are listed.

Entity

An Entity After Match is executed only for inputs that match the selected Entity.
There is no mandatory connection between Entities matched in the list of Matches and those added to the After Matches, i.e. Entity After Matches can be defined even if no Entity Match is defined or even for different Entities.

When an Entity After Match is added, it is possible to add a number of mappings from one of the NLU Variables of the Entity; every time a new input matches the Entity, the values in the source are stored in the selected targets. The same source can be selected multiple times, but each target can just be selected once (as multiple values would overwrite previous ones).

Language Object

The Language Object After Match is executed only for inputs that match the syntax of the selected Language Object.
There is no mandatory connection between Language Objects matched in the list of Matches and those added as After Matches, i.e. Language Object After Matches can be defined even if no Language Object Match is defined or even for different Language Objects.

When a Language Object After Match is added, it is possible to add a number of mappings from one of the NLU Variables of the Language Object to Global or Flow Variables; every time a new input matches the Language Object's syntax, the value in the source is stored in the selected target. The same source can be selected multiple times, but each target can be selected only once (as multiple values would overwrite the previous ones).

Listener

The Listener After Matches are activated whenever the User Intent trigger or transition is triggered and the TLML syntax of the Listener matches the user input. In those cases, the Groovy script expression of the Listener is executed.
The Listener After Match substitutes the former Trigger Post Listener; they are customizable with the same semantics as the previous Trigger Post Listeners.

In Teneo Studio Desktop, just below the Syntax editor, the Advanced Options provide the following three options:

  • "Test sentences from" enables the developer to select if the sentences in the user input should be tested from "Last to first" (default setting) or "First to last", i.e., when the user input is made up of more than one sentence, "Last to first" tests the last sentence in the input first and moves backwards while "First to last" tests the first sentence first and continues moving forward
  • "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
  • "Stop after" permits selecting when Teneo Engine should stop testing sentences and provides the following options:
    • All sentences tested: the TLML syntax of the Listener is tested against all the sentences in the user input creating an array of results
    • First Match (default): testing is stopped when a match is found
    • Current sentences tested: the TLML syntax of the Listener attempts to match against the most recent syntax (the previous trigger or conditional transition).

Script

The Script After Matches let the user execute Groovy scripts whenever the User Intent trigger or transition is matched.