Javascript Annotator
The Javascript Annotator allows annotations to be generated by executing a
program or expression written in JavaScript.
The layer manager has two modes of operation:
- Label Mapping
- new annotation labels are generated from a small
JavaScript expression operating on the label from a given source layer.
- Full Script
- a full script is given the whole annotation graph, which
it can traverse, process, and add annotations to.
Configuration parameters are encoded as a JSON string, e.g.
{
"labelMapping":"true",
"sourceLayerId":"word",
"destinationLayerId":"js",
"transcriptLanguageLayerId":"transcript_language",
"phraseLanguageLayerId":"language",
"language":"en.*",
"script":"length"
}
The parameters are:
- labelMapping
- "true" for Label Mapping mode. Otherwise the
mode is assumed to be Full Script.
- script
- The JavaScript script to execute.
In Full Script mode, this is the complete script, and no other parameters
are required.
In Label Mapping mode, this is the expression to apply to the source annotation
label, and the following parameters also apply:
- sourceLayerId
- Input layer from which annotations are selected.
- destinationLayerId
- Output layer on which new annotations are added.
- transcriptLanguageLayerId
- Transcript attribute for overall language.
- phraseLanguageLayerId
- Layer annotating phrases in a different language.
- language
- Regular expression for the ISO language codes of the
languages to target, or blank for all.