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, held in
a ThreadLocal, as DictionaryLookup instances are stateful and must
not be used concurrently. Call clearThreadLocalState() to release the
lookup of the current thread.
-
Constructor Summary
ConstructorsConstructorDescriptionMorfologikTagDictionary(morfologik.stemming.Dictionary dict) Initializes a case sensitiveMorfologikTagDictionaryMorfologikTagDictionary(morfologik.stemming.Dictionary dict, boolean caseSensitive) Initializes aMorfologikTagDictionary -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves theDictionaryLookupof the current thread 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- 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 theDictionaryLookupof the current thread to prevent classloader leaks in container environments. Call when the thread is returned to a pool or the dictionary is no longer needed; a later lookup on the same thread creates a new one.
-