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

Example

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 Language Object contains the following syntax:

tlml

1dog / cat / snake / lizard
2

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's TLML Syntax 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's TLML Syntax will attempt to match against the most recent syntax (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.
Example

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

The User Intent (trigger) contains the following TLML syntax Match:

tlml

1insurance + %ANIMALS.LIST
2

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

tlml

1dog / cat / snake / lizard
2

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 syntax:

tlml

1%ANIMALS.LIST
2

and operation:

tlml

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

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

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

Limit unused words
Global Listeners
Flow Listeners
Define an Intent Trigger
Transitions