Teneo Developers

Share to

Predicate scripts

Predicate scripts are a type of attached scripts in addition to the propagation scripts. The predicate scripts allow users to attach NLU/annotation variable value dependent constraints to conditions. Predicate scripts are syntactically attached to condition with the colon (:) symbol and embedded inside curly brackets:

tlml

1%CITY_ENTITY:{lob.sCity=="New York"}
2

A predicate script, much like the propagation script, has access to the special variable _USED_WORDS as well as to the special, read-only variable called lob. This lob variable is a read-only map that is granting access to the NLU/annotation variable values from the language object, entity or annotation it is directly attached to.

This makes it possible to match a condition if a variable fulfill a specified criterion, for instance, only match on an annotation if its variable for confidence score lies within a given range or only match on an entity if a given NLU variable contain a specific value.

Following the same attach rules as propagation scripts, predicate scripts can be attached to

  • a bracket condition: (*):{_USED_WORDS!="hello"}
  • a language object condition: %ANIMALS.LIST:{lob.sAnimalType=="Pet"}
  • an entity condition: %CITY_ENTITY:{lob.sCity=="New York"}
  • and an annotation condition: %$NUMBER:{lob.numbericValue>100}

Access rules for predicate scripts

The access rules for predicate scripts can be found in the Condition Reference Manual.

Annotations
Predicate scripts in the Condition Reference Manual
NLU Variables and propagation scripts
Listeners and Variables