Class HunspellDictionary

java.lang.Object
opennlp.tools.stemmer.hunspell.HunspellDictionary

@ThreadSafe public final class HunspellDictionary extends Object
An immutable, in-memory Hunspell-format dictionary loaded from user-supplied .aff and .dic files. OpenNLP includes no dictionary data.

Supported affix features are PFX and SFX rules with strip strings, character-class conditions, cross-product combinations, and continuation classes. COMPLEXPREFIXES selects 2 prefixes and 1 suffix instead of 1 prefix and 2 suffixes. FLAG, AF, AM, and SET declarations apply throughout the file. Input and output conversions, ignored characters, case restrictions, compound flags and patterns, and word breaks are applied during stemming. The blocking flags NEEDAFFIX (also named PSEUDOROOT), ONLYINCOMPOUND, and FORBIDDENWORD, plus CIRCUMFIX and FULLSTRIP, are also applied.

Loading defaults to HunspellDictionary.LoadMode.STRICT: unsupported affix directives cause an IOException. Recognized metadata and suggestion settings that do not affect stemming are ignored. HunspellDictionary.LoadMode.ALLOW_PARTIAL skips other directives and reports them through getUnsupportedDirectives(). Morphological stems use st:, sp:, and ds: fields. SYLLABLENUM supports Hungarian compound syllable adjustments. LEMMA_PRESENT is accepted and has no effect. Strict loading validates declarations; it does not establish that every result matches Hunspell.

Instances are immutable and safe to share between threads.

Since:
3.0.0
See Also: