Teneo Developers

Sentence test order and stop testing

Sentence test order

The Sentence test order setting is available for triggers and transitions (with User Intent) in the Triggering section (right-side panel when selecting the node/transition in the Flow graph) under Advanced Options and in (the lower part of) the window of a Listener.

In normal operations, the Engine will stop testing sentences and user inputs once it has found a match, but the order which the Engine must follow when it looks for a match in a multi-sentence user input can be determined.

For this, it is possible to use the Test sentences from functionality to establish if the Engine should start testing at the first sentence and work forward (First to last) or if it should start at the last sentence and work back from there (Last to first).


Consider the following example:

User input: I have a dog. I have a cat. I have a nice car.

The TLML Syntax contains the Language Object %ANIMALS.LIST

The TLML Syntax of the Language object is:


1dog / cat / snake / lizard

If selecting Last to first:

  • the matched sentence will be I have a cat
  • the value of the Language Object variable (_USED_WORDS) would be cat.

If selecting First to last

  • the matched sentence will be I have a dog
  • the value of the Language Object variable (_USED_WORDS) would be dog.

Stop after...

TheStop after setting is only available for Listeners.

The Stop testing... option available at the bottom of the Listener window includes the following options:

  • First match: if selecting this option, testing will end once a match is found.
  • All sentences tested: in this case, the Listener condition will be tested against all the sentences in the user input, creating an array of the results.
  • Current sentences tested (only available on Post Listeners): in this case, the Listener condition will attempt to match against the most recent condition (the previous Trigger or input consuming Transition). This is why this option will only be available for Post listeners. For example, selecting this option on a flow trigger listener will have the effect of testing the sentence which triggered the flow. This way the user is making sure he or she is responding to the same thing as the flow.

User input: Do you sell pet insurance for my dog? I also have a cat

The Intent Trigger has the following condition:


1insurance + %ANIMALS.LIST

Where the Language Object ANIMALS.LIST contains the following condition:


1dog / cat / snake / lizard

and a Language Object variable called mv_animals with value _USED_WORDS.

The user of Teneo Studio may think that the end-user only has a dog, because cat is not taken into account by the Listener.

However, using the All sentences tested setting makes it possible to also capture cat with the following condition:



and operation:


1sAnimals = sAnimals + _.getLangObjVariable('mv_animals')

In this case, the following would be the results in sAnimals for a Last to first Listener with the %ANIMALS.LIST condition:

  • First match: cat
  • Current sentence tested: dog
  • All sentences tested: cat, dog

Limit unused words
Create a Listener
Define an Intent Trigger