Class HunspellStemmer
- All Implemented Interfaces:
opennlp.tools.stemmer.Stemmer
Stemmer over a HunspellDictionary: a surface form
is reduced to the dictionary words it can be derived from by removing one suffix, one
prefix, a cross-product combination of both, or an additional affix licensed by a
continuation class. Compound and break-separated forms return the stems of their
recognized parts.
stem(CharSequence) returns the first analysis, preferring the word's own
dictionary entry; stemAll(CharSequence) returns every distinct analysis. A
word with no analysis is returned unchanged, so the stemmer degrades to identity on
unknown input. Title-case and all-uppercase forms also use permitted case
variants, subject to the dictionary's case restrictions.
Entries the dictionary marks as virtual stems (NEEDAFFIX), compound-only
parts (ONLYINCOMPOUND), or forbidden words (FORBIDDENWORD) do not
count as standalone analyses.
Compound part search stops after 2048 part-licensing
attempts. The budget applies separately to each capitalization form of the input
and to each word-break search. Once it is used up, further compound analyses are
skipped.
The Stemmer interface leaves thread safety to the implementation. This
implementation reads only the immutable dictionary state, so a single instance is
safe to share between threads.
- Since:
- 3.0.0
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
HunspellStemmer
Initializes the stemmer.- Parameters:
dictionary- The dictionary to analyze against. Must not benull.- Throws:
IllegalArgumentException- Thrown ifdictionaryisnull.
-
-
Method Details
-
stem
Returns the first analysis, which prefers the word's own dictionary entry.
- Specified by:
stemin interfaceopennlp.tools.stemmer.Stemmer
-
stemAll
Returns every distinct analysis, or a single-element list of the unchanged word when it has none.
- Specified by:
stemAllin interfaceopennlp.tools.stemmer.Stemmer
-