Package morfologik.stemming
Class Dictionary
java.lang.Object
morfologik.stemming.Dictionary
A dictionary combines
FSA
automaton and DictionaryMetadata
describing the way terms are encoded in the automaton.
A dictionary consists of two files:
- an actual compressed FSA file,
DictionaryMetadata
, describing the way terms are encoded.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal FSA
FSA
automaton with the compiled dictionary data.final DictionaryMetadata
Metadata associated with the dictionary. -
Constructor Summary
ConstructorsConstructorDescriptionDictionary
(FSA fsa, DictionaryMetadata metadata) It is strongly recommended to use static methods in this class for reading dictionaries. -
Method Summary
Modifier and TypeMethodDescriptionstatic Dictionary
read
(InputStream fsaStream, InputStream metadataStream) Attempts to load a dictionary from opened streams of FSA dictionary data and associated metadata.static Dictionary
Attempts to load a dictionary using the URL to the FSA file and the expected metadata extension.static Dictionary
Attempts to load a dictionary using the path to the FSA file and the expected metadata extension.
-
Field Details
-
fsa
FSA
automaton with the compiled dictionary data. -
metadata
Metadata associated with the dictionary.
-
-
Constructor Details
-
Dictionary
It is strongly recommended to use static methods in this class for reading dictionaries.- Parameters:
fsa
- An instantiatedFSA
instance.metadata
- A map of attributes describing the compression format and other settings not contained in the FSA automaton. For an explanation of available attributes and their possible values, seeDictionaryMetadata
.
-
-
Method Details
-
read
Attempts to load a dictionary using the path to the FSA file and the expected metadata extension.- Parameters:
location
- The location of the dictionary file (*.dict
).- Returns:
- An instantiated dictionary.
- Throws:
IOException
- if an I/O error occurs.
-
read
Attempts to load a dictionary using the URL to the FSA file and the expected metadata extension.- Parameters:
dictURL
- The URL pointing to the dictionary file (*.dict
).- Returns:
- An instantiated dictionary.
- Throws:
IOException
- if an I/O error occurs.
-
read
Attempts to load a dictionary from opened streams of FSA dictionary data and associated metadata. Input streams are not closed automatically.- Parameters:
fsaStream
- The stream with FSA datametadataStream
- The stream with metadata- Returns:
- Returns an instantiated
Dictionary
. - Throws:
IOException
- if an I/O error occurs.
-