Teneo Developers

Annotations in Teneo Studio

Use annotations in conditions

Annotations can be used anywhere within the solution where it is possible to use a Language Object or Entity, following the Teneo Linguistic Modelling Language. To learn more about how annotations are generated within the Teneo Platform, please see here.

Annotations are, in addition to the % sign, also prefixed by a $ (dollar) sign. For an annotation condition to be fulfilled, an annotation with the same name given in the annotation condition must exist on the sentence itself or in one or more sentence words.

As an example, the condition in the image below would match an input sentence containing any word annotated as a noun, directly followed by any word annotated as a verb, directly followed by any word annotated as a pronoun.

Condition example

However, often it makes sense using annotations together with the Extended And operators and their negative equivalents, as they are used word based. With help of these powerful operators, it is possible to condition on both traditional Language Objects, Entities, and on attributes from the annotation layer on the same used word.

Manage annotations

Annotations can be added, updated, or removed in Pre-matching scripts or by scripting Pre-Global Listeners.

Given the object testAnnotation, created as:


1def testAnnotation = _.createInputAnnotation("TEST", 0, [] as Set, null)

testAnnotation can be added:



Or updated the same way (note that “Add” will overwrite if the added annotation already exists):


1_.getInputAnnotations().add(_.createInputAnnotation(“TEST”, 0, [] as Set, [new: “yes”]

Or removed:



Other methods allow to delete all annotations, for example:



For more information on the methods, please see the Annotations Interface Methods section.

Working with annotation variables

Annotation variables are accessible within a condition in the same way as either NLU variables or Language Object variables:

Language Object condition

Listener Data Action

Since annotation variables can be of any type, their values need to be converted accordingly if saved to other variable types:

Condition Match Requirement

Annotation variables can also be accessed via scripting. In the example script below, any annotation having a name ending with .POS and where the variable confidence has a value of 0.5 or lower is removed:

Script example

For more information on the methods, please see the section Annotation Class Methods.

Annotations in Tryout

Annotations summary

The visualization for tracking annotations is available in the Input section of the advanced Tryout window, the Annotations view summarizes information concerning the annotations managed during the input processing.

Annotations view in Tryout

It is also possible to hoover over the different annotations to obtain more information about them, such as a more detailed description or information on the variables and values.

Hoover over an annotation for more details

The Annotations summary also highlights if an annotation is updated or deleted; in the below image - using the example from the Working with annotation variables section above - which removed any annotation having a name ending with ".POS" and where the variable confidence has a value of 0.5 or lower, displays the removed annotations at the bottom of the Annotations summary. In the tested input sentence, the word "graph" is incorrectly tagged as verb, but the annotation is removed by the Pre-matching script as the variable confidence has the value of 0.0038.

Removal of annotations in Tryout

Input Processor Results

The Input Processor Results, also in the Input section of the advanced Tryout, displays more detailed information regarding the annotations, including whether they were added, deleted or modified, their variables, etc.

Export annotation information

Annotation information is also included in the text / CSV exports available in the Tryout by right-clicking and selecting Open as Text / CSV or Copy as Text / CSV.

Standard and system annotations
Annotations created by Input Processors
Teneo Input Processors API
Custom Configuration of Teneo Input Processors
Available Input Processors per languages