Class DictionaryMetadata
java.lang.Object
morfologik.stemming.DictionaryMetadata
Description of attributes, their types and default values.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDictionaryMetadata(Map<DictionaryAttribute, String> attrs) Create an instance from an attribute map. -
Method Summary
Modifier and TypeMethodDescriptionstatic DictionaryMetadataBuilderbuilder()static StringgetExpectedMetadataFileName(String dictionaryFile) Returns the expected name of the metadata file, based on the name of the dictionary file.static PathgetExpectedMetadataLocation(Path dictionary) bytecharbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanstatic DictionaryMetadataread(InputStream metadataStream) Read dictionary metadata from a property file (stream).voidWrite dictionary attributes (metadata).
-
Field Details
-
METADATA_FILE_EXTENSION
-
-
Constructor Details
-
DictionaryMetadata
Create an instance from an attribute map.- Parameters:
attrs- A set ofDictionaryAttributekeys and their associated values.- See Also:
-
-
Method Details
-
getAttributes
- Returns:
- Return all metadata attributes.
-
getEncoding
-
getSeparator
public byte getSeparator() -
getLocale
-
getInputConversionPairs
-
getOutputConversionPairs
-
getReplacementPairs
-
getEquivalentChars
-
isFrequencyIncluded
public boolean isFrequencyIncluded() -
isIgnoringPunctuation
public boolean isIgnoringPunctuation() -
isIgnoringNumbers
public boolean isIgnoringNumbers() -
isIgnoringCamelCase
public boolean isIgnoringCamelCase() -
isIgnoringAllUppercase
public boolean isIgnoringAllUppercase() -
isIgnoringDiacritics
public boolean isIgnoringDiacritics() -
isConvertingCase
public boolean isConvertingCase() -
isSupportingRunOnWords
public boolean isSupportingRunOnWords() -
getDecoder
- Returns:
- Returns a new
CharsetDecoderfor theencoding.
-
getEncoder
- Returns:
- Returns a new
CharsetEncoderfor theencoding.
-
getSequenceEncoderType
- Returns:
- Return sequence encoder type.
-
getSeparatorAsChar
public char getSeparatorAsChar()- Returns:
- Returns the
separatorbyte converted to a singlechar. - Throws:
RuntimeException- if this conversion is for some reason impossible (the byte is a surrogate pair, FSA'sencodingis not available).
-
builder
- Returns:
- A shortcut returning
DictionaryMetadataBuilder.
-
getExpectedMetadataFileName
Returns the expected name of the metadata file, based on the name of the dictionary file. The expected name is resolved by truncating any file extension ofnameand appendingMETADATA_FILE_EXTENSION.- Parameters:
dictionaryFile- The name of the dictionary (*.dict) file.- Returns:
- Returns the expected name of the metadata file.
-
getExpectedMetadataLocation
-
read
Read dictionary metadata from a property file (stream).- Parameters:
metadataStream- The stream with metadata.- Returns:
- Returns
DictionaryMetadataread from a the stream (property file). - Throws:
IOException- Thrown if an I/O exception occurs.
-
write
Write dictionary attributes (metadata).- Parameters:
writer- The writer to write to.- Throws:
IOException- Thrown when an I/O error occurs.
-