Package opennlp.tools.doccat
Class EmojiFeatureGenerator
java.lang.Object
opennlp.tools.doccat.EmojiFeatureGenerator
- All Implemented Interfaces:
opennlp.tools.doccat.FeatureGenerator
Generates document features from the emoji annotation layer: for every annotated token the
project-authored coarse sentiment score (
emojiSentiment=2), the entity type
(emojiType=HEART), the document category hint
(emojiCategory=SMILEYS_AND_EMOTION), and for flags the ISO 3166 region
(emojiRegion=DE). Tokens that are not annotated symbols contribute nothing.
Strictly opt-in: pass it alongside the defaults, for example
new DoccatFactory(new FeatureGenerator[] {new BagOfWordsFeatureGenerator(),
new EmojiFeatureGenerator()}); the default factory configuration is unchanged. The no-argument
constructor is required so a trained model can re-instantiate the generator from its
manifest.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a generator over the bundled and derived annotation layers.EmojiFeatureGenerator(EmojiAnnotator annotator) Instantiates a generator over a configured annotator, for example one with a gazetteer join. -
Method Summary
Modifier and TypeMethodDescriptionextractFeatures(String[] text, Map<String, Object> extraInformation)
-
Constructor Details
-
EmojiFeatureGenerator
public EmojiFeatureGenerator()Instantiates a generator over the bundled and derived annotation layers. -
EmojiFeatureGenerator
Instantiates a generator over a configured annotator, for example one with a gazetteer join.- Parameters:
annotator- The annotator to use. Must not benull.- Throws:
IllegalArgumentException- ifannotatorisnull.
-
-
Method Details
-
extractFeatures
- Specified by:
extractFeaturesin interfaceopennlp.tools.doccat.FeatureGenerator- Throws:
IllegalArgumentException- iftextisnull.
-