Skip to content

onTaggerLevel

The onTaggerLevel handling function is similar to onTagger, with the difference that onTaggerLevel is called each time the evaluation of tagging rules for a given level is over.

The function must be defined like this:

function onTaggerLevel(level) {
  ...
}

where level is the level specified in tagging rules.

For example, consider these tags.

TAGS
{
    @COLOR,
    @RAINBOW
}

If you apply these tagging rules:

SCOPE SENTENCE
{
    TAGGER(10)
    {
        @COLOR[LEMMA("blue", "indigo", "black", "brown", "red", "orange", "green", "yellow", "turquoise", "pink", "violet", "grey", "violet")] 
    }

    TAGGER()
    {    
        @RAINBOW[LEMMA("red", "orange", "yellow", "green", "blue", "indigo", "violet")]
    }
}

to this text:

The colors of the rainbow are: red, orange, yellow, green, blue, indigo and violet

with this code:

function onTaggerLevel(level) {
if (level==10) {
...
} else if (level==10000) {
...
}
}

you will get, in Studio Semantic Analysis tool window:

While on the left side you see a single tag tile above a token, on the right side you can see both tags attributed to a token.

Note

The asterisk beside the tag name means that a token has more tags.

The code after the first if is executed after determining the level 10 tag, while the code after the second if is executed after determining the level 10000 tag.