Class SubTypeAnnotator

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    DefaultEntityAnnotator, ENEntityAnnotator

    public class SubTypeAnnotator
    extends Annotator
    An annotator that provides its annotation by annotating for sub-types. During creation of the annotator "non-overlapping" mode can specified which will not allow overlapping sub-type annotations. The best annotation is determined first on confidence of annotation and then on number of tokens matched. This behavior can be overidden in child classes by overriding the protected compare(Annotation, Annotation) method.
    Author:
    David B. Bracewell
    See Also:
    Serialized Form
    • Constructor Detail

      • SubTypeAnnotator

        public SubTypeAnnotator​(@NonNull
                                @NonNull AnnotationType annotationType,
                                boolean nonOverlapping,
                                @NonNull
                                @NonNull Collection<AnnotationType> subTypes)
        Instantiates a new SubTypeAnnotator.
        Parameters:
        annotationType - the annotation type being provided
        nonOverlapping - True - if the sub-types should not overlap one another where the best annotation is picked using longest match / highest probability. False allow overlapping annotations.
        subTypes - the collection of AnnotationType representing the sub-types to annotate.
        Throws:
        IllegalArgumentException - - If one or more of the sub types is not an instance of annotationType
      • SubTypeAnnotator

        public SubTypeAnnotator​(@NonNull
                                @NonNull AnnotationType annotationType,
                                @NonNull
                                @NonNull Collection<AnnotationType> subTypes)
        Instantiates a new SubTypeAnnotator where overlapping annotations is not allowed..
        Parameters:
        annotationType - the annotation type being provided
        subTypes - the collection of AnnotationType representing the sub-types to annotate.
        Throws:
        IllegalArgumentException - - If one or more of the sub types is not an instance of annotationType
    • Method Detail

      • annotateImpl

        protected final void annotateImpl​(Document document)
        Description copied from class: Annotator
        Annotates a document with one or more AnnotatableType defined in satisfies().
        Specified by:
        annotateImpl in class Annotator
        Parameters:
        document - The document to annotate
      • satisfies

        public Set<AnnotatableType> satisfies()
        Description copied from class: Annotator
        The set of annotation types that this annotator satisfies by this annotator
        Specified by:
        satisfies in class Annotator
        Returns:
        the set of satisfied annotation types