Class LinguisticsAnnotator

java.lang.Object
com.yahoo.vespa.indexinglanguage.linguistics.LinguisticsAnnotator

public class LinguisticsAnnotator extends Object
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

    Constructors
    Constructor
    Description
    LinguisticsAnnotator(com.yahoo.language.Linguistics factory, AnnotatorConfig config)
    Constructs a new instance of this annotator.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    annotate(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.Annotation
    termAnnotation(String term, String originalTerm)
    Creates a TERM annotation which has the term as annotation (only) if it is different from the original.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LinguisticsAnnotator

      public LinguisticsAnnotator(com.yahoo.language.Linguistics factory, AnnotatorConfig config)
      Constructs a new instance of this annotator.
      Parameters:
      factory - the linguistics factory to use when annotating
      config - 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.