Annotations in Teneo Studio
Use annotations in syntaxes
Annotations can be used anywhere within the solution where it is possible to use a Language Object or Entity, following the Teneo Linguistic Modeling 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 syntax to be fulfilled, an annotation with the same name given in the annotation syntax must exist on the sentence itself or in one or more sentence words.
As an example, the syntax 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.
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.
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) 2
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”] 2
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 syntax in the same way as either NLU variables or Language Object variables:
Since annotation variables can be of any type, their values need to be converted accordingly if saved to other variable types:
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:
For more information on the methods, please see the section Annotation Class Methods.
Annotations in Tryout
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.
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.
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.
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.