Package com.gengoai.hermes.annotator
Class SubTypeAnnotator
- java.lang.Object
-
- com.gengoai.hermes.annotator.Annotator
-
- com.gengoai.hermes.annotator.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 protectedcompare(Annotation, Annotation)
method.- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SubTypeAnnotator(@NonNull AnnotationType annotationType, boolean nonOverlapping, @NonNull Collection<AnnotationType> subTypes)
Instantiates a new SubTypeAnnotator.SubTypeAnnotator(@NonNull AnnotationType annotationType, @NonNull Collection<AnnotationType> subTypes)
Instantiates a new SubTypeAnnotator where overlapping annotations is not allowed..
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
annotateImpl(Document document)
Annotates a document with one or more AnnotatableType defined insatisfies()
.protected Annotation
compare(Annotation a1, Annotation a2)
protected List<Annotation>
getAnnotations(HString fragment)
Set<AnnotatableType>
satisfies()
The set of annotation types that this annotator satisfies by this annotator-
Methods inherited from class com.gengoai.hermes.annotator.Annotator
annotate, getProvider, requires
-
-
-
-
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 providednonOverlapping
- 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 providedsubTypes
- 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 insatisfies()
.- Specified by:
annotateImpl
in classAnnotator
- Parameters:
document
- The document to annotate
-
compare
protected Annotation compare(Annotation a1, Annotation a2)
-
getAnnotations
protected List<Annotation> getAnnotations(HString fragment)
-
satisfies
public Set<AnnotatableType> satisfies()
Description copied from class:Annotator
The set of annotation types that this annotator satisfies by this annotator
-
-