Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## morfologik.fsa.dictionary
Class Dictionary

    java.lang.Object
      morfologik.fsa.dictionary.Dictionary

    public class Dictionary

extends java.lang.Object

A dictionary combines `FSA` automaton and metadata describing the internals of dictionary entries' coding (`DictionaryFeatures`.

A dictionary consists of two files:

- an actual compressed FSA file,
- a metadata file, describing the dictionary.

Use static methods in this class to read dictionaries and their metadata.

Field Summary
`DictionaryFeatures` | `features` Features of the dictionary.
`FSA` | `fsa` `FSA` automaton with the compiled dictionary data.

Constructor Summary
`Dictionary(FSA fsa, DictionaryFeatures features)` It is strongly recommended to use static methods in this class for reading dictionaries.

Method Summary
`static java.lang.String` | `getExpectedFeaturesName(java.lang.String name)` Returns the expected name of the features file, based on the name of the FSA dictionary file.
`static Dictionary` | `read(java.io.File fsaFile)` Attempts to load a dictionary based on the path to the fsa file (the expected suffix of the FSA file is `.dict`.
`static Dictionary` | `read(java.io.InputStream fsaData, java.io.InputStream featuresData)` Attempts to load a dictionary based on the stream of the fsa dictionary and the metadata (features) file.
`static Dictionary` | `read(java.net.URL fsaURL)` Attempts to load a dictionary based on the URL to the FSA file (the expected suffix of the FSA file is `.dict`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### fsa

    public final FSA fsa

  `FSA` automaton with the compiled dictionary data.

### features

    public final DictionaryFeatures features

  Features of the dictionary.

Constructor Detail

### Dictionary

    public Dictionary(FSA fsa,
                      DictionaryFeatures features)

  It is strongly recommended to use static methods in this class for reading dictionaries.

  Parameters:
    `fsa` - An instantiated `FSA` instance.
    `features` - 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, see `DictionaryFeatures`.

Method Detail

### read

    public static Dictionary read(java.io.File fsaFile)
                           throws java.io.IOException

  Attempts to load a dictionary based on the path to the fsa file (the expected suffix of the FSA file is `.dict`.

  Throws:
    `java.io.IOException`

### read

    public static Dictionary read(java.net.URL fsaURL)
                           throws java.io.IOException

  Attempts to load a dictionary based on the URL to the FSA file (the expected suffix of the FSA file is `.dict`.

  This method can be used to load resource-based dictionaries, but be aware of JAR resource-locking issues that arise from resource URLs.

  Throws:
    `java.io.IOException`

### read

    public static Dictionary read(java.io.InputStream fsaData,
                                  java.io.InputStream featuresData)
                           throws java.io.IOException

  Attempts to load a dictionary based on the stream of the fsa dictionary and the metadata (features) file.

  Throws:
    `java.io.IOException`

### getExpectedFeaturesName

    public static java.lang.String getExpectedFeaturesName(java.lang.String name)

  Returns the expected name of the features file, based on the name of the FSA dictionary file. The expected name is resolved by truncating any suffix of `name` and appending `FEATURES_SUFFIX`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD