Package com.gengoai.hermes.annotator
Class FuzzyLexiconAnnotator
- java.lang.Object
-
- com.gengoai.hermes.annotator.Annotator
-
- com.gengoai.hermes.annotator.SentenceLevelAnnotator
-
- com.gengoai.hermes.annotator.ViterbiAnnotator
-
- com.gengoai.hermes.annotator.FuzzyLexiconAnnotator
-
- All Implemented Interfaces:
Serializable
public class FuzzyLexiconAnnotator extends ViterbiAnnotator
A lexicon annotator that allows gaps to occur in multi-word expressions. For example, "old red car" and "old broke car" would match the lexicon item "old car" with a distance of one.
- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FuzzyLexiconAnnotator(@NonNull AnnotationType annotationType, @NonNull AttributeType<?> attributeType, @NonNull Lexicon lexicon, @NonNull Language lexiconLanguage, int maxDistance)
Instantiates a new FuzzyLexiconAnnotator.FuzzyLexiconAnnotator(@NonNull AnnotationType annotationType, @NonNull AttributeType<?> attributeType, @NonNull String lexiconName, @NonNull Language lexiconLanguage, int maxDistance)
Instantiates a new FuzzyLexiconAnnotator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
createAndAttachAnnotation(Document document, LexiconMatch match)
Given an possible span determines if an annotation should be created and if so creates and attaches it.String
getProvider(Language language)
Gets the provider information for this annotator..Set<AnnotatableType>
satisfies()
The set of annotation types that this annotator satisfies by this annotatorprotected LexiconEntry
scoreSpan(HString span)
Scores the given span.-
Methods inherited from class com.gengoai.hermes.annotator.ViterbiAnnotator
annotate, combineScore
-
Methods inherited from class com.gengoai.hermes.annotator.SentenceLevelAnnotator
annotateImpl, furtherRequires, requires
-
-
-
-
Constructor Detail
-
FuzzyLexiconAnnotator
public FuzzyLexiconAnnotator(@NonNull @NonNull AnnotationType annotationType, @NonNull @NonNull AttributeType<?> attributeType, @NonNull @NonNull Lexicon lexicon, @NonNull @NonNull Language lexiconLanguage, int maxDistance)
Instantiates a new FuzzyLexiconAnnotator.- Parameters:
annotationType
- the annotationType of annotation to create.attributeType
- the attribute typelexicon
- the lexicon to perform annotation based onlexiconLanguage
- the language of the lexiconmaxDistance
- the maximum fuzzy distance allowed.
-
FuzzyLexiconAnnotator
public FuzzyLexiconAnnotator(@NonNull @NonNull AnnotationType annotationType, @NonNull @NonNull AttributeType<?> attributeType, @NonNull @NonNull String lexiconName, @NonNull @NonNull Language lexiconLanguage, int maxDistance)
Instantiates a new FuzzyLexiconAnnotator.- Parameters:
annotationType
- the annotationType of annotation to create.attributeType
- the attribute typelexiconName
- the name of the lexicon to perform annotation based onlexiconLanguage
- the language of the lexiconmaxDistance
- the maximum fuzzy distance allowed.
-
-
Method Detail
-
createAndAttachAnnotation
protected void createAndAttachAnnotation(Document document, LexiconMatch match)
Description copied from class:ViterbiAnnotator
Given an possible span determines if an annotation should be created and if so creates and attaches it.- Specified by:
createAndAttachAnnotation
in classViterbiAnnotator
- Parameters:
document
- the documentmatch
- The span to check
-
getProvider
public String getProvider(Language language)
Description copied from class:Annotator
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.- Overrides:
getProvider
in classAnnotator
- Returns:
- the provider
-
satisfies
public Set<AnnotatableType> satisfies()
Description copied from class:Annotator
The set of annotation types that this annotator satisfies by this annotator
-
scoreSpan
protected LexiconEntry scoreSpan(HString span)
Description copied from class:ViterbiAnnotator
Scores the given span.- Specified by:
scoreSpan
in classViterbiAnnotator
- Parameters:
span
- The span- Returns:
- The score of the span
-
-