Package com.gengoai.hermes.annotator
Class Annotator
- java.lang.Object
-
- com.gengoai.hermes.annotator.Annotator
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DefaultCategoryAnnotator
,DefaultLemmaAnnotator
,DefaultMlEntityAnnotator
,DefaultSentenceAnnotator
,DefaultStemAnnotator
,DefaultTokenAnnotator
,DefaultTransliterationAnnotator
,RegexAnnotator
,SentenceLevelAnnotator
,SubTypeAnnotator
public abstract class Annotator extends Object implements Serializable
An annotator processes documents adding one or more
AnnotatableType
s. An annotator may require specific types of annotations to be present on the document before it can process the document (by default it requires none). Annotators define a provider name (getProvider(Language)
) that identifies the model, version, lexicon, etc. used by the annotator to produce its annotations (by default this is set "SimpleClassName v1.0").Note: Annotator implementations should be implemented in a thread safe manner.
- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Annotator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
annotate(@NonNull Document document)
Annotates a document with one or more AnnotatableType defined insatisfies()
.protected abstract void
annotateImpl(Document document)
Annotates a document with one or more AnnotatableType defined insatisfies()
.String
getProvider(Language language)
Gets the provider information for this annotator..Set<AnnotatableType>
requires()
The annotation types required to be on a document before this annotator can annotateabstract Set<AnnotatableType>
satisfies()
The set of annotation types that this annotator satisfies by this annotator
-
-
-
Method Detail
-
annotate
public final void annotate(@NonNull @NonNull Document document)
Annotates a document with one or more AnnotatableType defined insatisfies()
.- Parameters:
document
- The document to annotate
-
annotateImpl
protected abstract void annotateImpl(Document document)
Annotates a document with one or more AnnotatableType defined insatisfies()
.- Parameters:
document
- The document to annotate
-
getProvider
public String getProvider(Language language)
Gets the provider information for this annotator.. The provider information should relate to a version number, model used, or something else to identify the settings of the annotator.- Parameters:
language
-- Returns:
- the provider
-
requires
public Set<AnnotatableType> requires()
The annotation types required to be on a document before this annotator can annotate- Returns:
- the set of required annotation types
-
satisfies
public abstract Set<AnnotatableType> satisfies()
The set of annotation types that this annotator satisfies by this annotator- Returns:
- the set of satisfied annotation types
-
-