Class WholeDocumentLanguageDispatchAnnotatorBuilder

java.lang.Object
com.basistech.rosette.dm.util.WholeDocumentLanguageDispatchAnnotatorBuilder

public class WholeDocumentLanguageDispatchAnnotatorBuilder extends Object
Fluent builder for annotators that delegate to other annotators based on the language from AnnotatedText.getWholeTextLanguageDetection(). You supply this builder with pairs of LanguageCode, Annotator, and then call build() to build an Annotator. The resulting annotator handles only Annotator.annotate(com.basistech.rosette.dm.AnnotatedText). It looks at the first LanguageDetection.DetectionResult from AnnotatedText.getWholeTextLanguageDetection(), and selects the annotator corresponding to the language in that detection result, delegating the call to that annotator.
  • Constructor Details

    • WholeDocumentLanguageDispatchAnnotatorBuilder

      public WholeDocumentLanguageDispatchAnnotatorBuilder()
      Create a builder.
  • Method Details

    • delegate

      public WholeDocumentLanguageDispatchAnnotatorBuilder delegate(com.basistech.util.LanguageCode language, Annotator delegate)
      Add a delegate
      Parameters:
      language - the language to process.
      delegate - the annotator to process it.
      Returns:
      this.
    • build

      public Annotator build()
      Create the annotator.
      Returns:
      the annotator.