public final class DictionaryMetadata extends Object
Modifier and Type | Field and Description |
---|---|
static String |
METADATA_FILE_EXTENSION
Expected metadata file extension.
|
Constructor and Description |
---|
DictionaryMetadata(Map<DictionaryAttribute,String> attrs)
Create an instance from an attribute map.
|
public static final String METADATA_FILE_EXTENSION
public DictionaryMetadata(Map<DictionaryAttribute,String> attrs)
attrs
- A set of DictionaryAttribute
keys and their associated values.DictionaryMetadataBuilder
public Map<DictionaryAttribute,String> getAttributes()
public String getEncoding()
public byte getSeparator()
public Locale getLocale()
public LinkedHashMap<String,String> getInputConversionPairs()
public LinkedHashMap<String,String> getOutputConversionPairs()
public LinkedHashMap<String,List<String>> getReplacementPairs()
public LinkedHashMap<Character,List<Character>> getEquivalentChars()
public boolean isFrequencyIncluded()
public boolean isIgnoringPunctuation()
public boolean isIgnoringNumbers()
public boolean isIgnoringCamelCase()
public boolean isIgnoringAllUppercase()
public boolean isIgnoringDiacritics()
public boolean isConvertingCase()
public boolean isSupportingRunOnWords()
public CharsetDecoder getDecoder()
CharsetDecoder
for the encoding
.public CharsetEncoder getEncoder()
CharsetEncoder
for the encoding
.public EncoderType getSequenceEncoderType()
public char getSeparatorAsChar()
separator
byte converted to a single
char
.RuntimeException
- if this conversion is for some reason impossible (the byte is a
surrogate pair, FSA's encoding
is not available).public static DictionaryMetadataBuilder builder()
DictionaryMetadataBuilder
.public static String getExpectedMetadataFileName(String dictionaryFile)
name
and appending
METADATA_FILE_EXTENSION
.dictionaryFile
- The name of the dictionary (*.dict
) file.public static Path getExpectedMetadataLocation(Path dictionary)
dictionary
- The location of the dictionary file.public static DictionaryMetadata read(InputStream metadataStream) throws IOException
metadataStream
- The stream with metadata.DictionaryMetadata
read from a the stream (property file).IOException
- Thrown if an I/O exception occurs.public void write(Writer writer) throws IOException
writer
- The writer to write to.IOException
- Thrown when an I/O error occurs.Copyright © 2016. All rights reserved.