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
Edit an After Match
Delete an After Match
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.