Class MorfologikTagDictionary
java.lang.Object
opennlp.morfologik.tagdict.MorfologikTagDictionary
- All Implemented Interfaces:
opennlp.tools.postag.TagDictionary
A
TagDictionary implementation based on Morfologik binary
dictionaries.
This implementation is thread-safe: the immutable Dictionary is shared
and each thread looks words up through its own DictionaryLookup, as
DictionaryLookup instances are stateful and must not be used concurrently.
-
Constructor Summary
ConstructorsConstructorDescriptionMorfologikTagDictionary(morfologik.stemming.Dictionary dict) Initializes a case sensitiveMorfologikTagDictionaryMorfologikTagDictionary(morfologik.stemming.Dictionary dict, boolean caseSensitive) Initializes aMorfologikTagDictionary -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves thread-local state to prevent classloader leaks in container environments.String[]boolean
-
Constructor Details
-
MorfologikTagDictionary
Initializes a case sensitiveMorfologikTagDictionary- Parameters:
dict- A Morfologik FSADictionary.- Throws:
IllegalArgumentException- Thrown if FSA's root node cannot be acquired (dictionary is empty).
-
MorfologikTagDictionary
public MorfologikTagDictionary(morfologik.stemming.Dictionary dict, boolean caseSensitive) throws IllegalArgumentException Initializes aMorfologikTagDictionary- Parameters:
dict- A Morfologik FSADictionary.caseSensitive- Iftrueit performs case-sensitive lookup, otherwise words are lower-cased withLocale.ROOTbefore lookup.- Throws:
IllegalArgumentException- Thrown if FSA's root node cannot be acquired (dictionary is empty).
-
-
Method Details
-
getTags
-
isCaseSensitive
public boolean isCaseSensitive()- Specified by:
isCaseSensitivein interfaceopennlp.tools.postag.TagDictionary
-
clearThreadLocalState
public void clearThreadLocalState()Removes thread-local state to prevent classloader leaks in container environments. Call when the thread is returned to a pool or the dictionary is no longer needed.
-