Class LinguisticsAnnotator
java.lang.Object
com.yahoo.vespa.indexinglanguage.linguistics.LinguisticsAnnotator
This annotates strings that are to be indexed with the tokens to index,
as produced by the give linguistics implementation.
Using annotations lets us provide the tokens to index without mutating
the original string which we need to store.
The annotations are placed in an annotation tree named "linguistics".
- Author:
- Simon Thoresen Hult
-
Constructor Summary
ConstructorsConstructorDescriptionLinguisticsAnnotator(com.yahoo.language.Linguistics factory, AnnotatorConfig config) Constructs a new instance of this annotator. -
Method Summary
Modifier and TypeMethodDescriptionbooleanannotate(com.yahoo.document.datatypes.StringFieldValue text, com.yahoo.document.DocumentId docId, boolean isReindexingOperation) Annotates the given string with the appropriate linguistics annotations.static com.yahoo.document.annotation.AnnotationtermAnnotation(String term, String originalTerm) Creates a TERM annotation which has the term as annotation (only) if it is different from the original.
-
Constructor Details
-
LinguisticsAnnotator
Constructs a new instance of this annotator.- Parameters:
factory- the linguistics factory to use when annotatingconfig- the linguistics config to use
-
-
Method Details
-
annotate
public boolean annotate(com.yahoo.document.datatypes.StringFieldValue text, com.yahoo.document.DocumentId docId, boolean isReindexingOperation) Annotates the given string with the appropriate linguistics annotations.- Parameters:
text- the text to annotate- Returns:
- whether anything was annotated
-
termAnnotation
public static com.yahoo.document.annotation.Annotation termAnnotation(String term, String originalTerm) Creates a TERM annotation which has the term as annotation (only) if it is different from the original.
-