public class DictionaryManager
extends java.lang.Object
DictionarySet
class obtained from the dictionarySet() method.
The subclasses of DictionaryManager are all convenience classes
with particular word lists loaded.
| Constructor and Description |
|---|
DictionaryManager()
Creates a
DictionaryManager with an empty set of dictionaries. |
| Modifier and Type | Method and Description |
|---|---|
Dictionary |
create(java.lang.String name,
java.lang.String description,
java.io.File wordListFile)
Creates a
Dictionary using the supplied word list. |
Dictionary |
create(java.lang.String name,
java.lang.String description,
java.io.File wordListFile,
boolean isNormalised)
Creates a
Dictionary using the supplied word list. |
Dictionary |
create(java.lang.String name,
java.lang.String description,
java.io.Reader wordListReader,
boolean isNormalised)
Creates a
Dictionary using the supplied word list which can be
in a jar file, on the file system or …. |
DictionarySet |
dictionarySet()
Retrieves the current dictionary set.
|
void |
reset()
Resets the dictionary manager to its default settings and
creates a new default (empty) dictionary set.
|
void |
setCostThreshold(int maximumCost)
Sets the maximum cost of any suggested spellings returned by
a dictionary.
|
void |
setMaximumSuggestions(int maximumSuggestions)
Sets the maximum number of suggested spellings returned by
a dictionary.
|
public DictionaryManager()
DictionaryManager with an empty set of dictionaries.
Add dictionaries using the create methods.public final Dictionary create(java.lang.String name, java.lang.String description, java.io.File wordListFile) throws java.io.FileNotFoundException, java.io.IOException
Dictionary using the supplied word list. The dictionary
is registered with the current DictionarySet. To use an individual
dictionary use the reference returned by this method. To use a group of
dictionaries create them using this method then recover the
DictionarySet using dictionarySet()name - an unique name for the dictionary.description - a brief description of the dictionarywordListFile - a file containing a word listDictionaryjava.io.FileNotFoundException - if the word list file cannot be foundjava.io.IOException - if a problem is encountered reading the word listpublic final Dictionary create(java.lang.String name, java.lang.String description, java.io.File wordListFile, boolean isNormalised) throws java.io.FileNotFoundException, java.io.IOException
Dictionary using the supplied word list. The dictionary
is registered with the current DictionarySet. To use an individual
dictionary use the reference returned by this method. To use a group of
dictionaries create them using this method then recover the
DictionarySet using dictionarySet()name - an unique name for the dictionary.description - a brief description of the dictionarywordListFile - a file containing a word listisNormalised - indicates whether the word list should be normalised to lower case.Dictionaryjava.io.FileNotFoundException - if the word list file cannot be foundjava.io.IOException - if a problem is encountered reading the word listpublic final Dictionary create(java.lang.String name, java.lang.String description, java.io.Reader wordListReader, boolean isNormalised) throws java.io.FileNotFoundException, java.io.IOException
Dictionary using the supplied word list which can be
in a jar file, on the file system or …. The dictionary
is registered with the current DictionarySet. To use an individual
dictionary use the reference returned by this method. To use a group of
dictionaries create them using this method then recover the
DictionarySet using dictionarySet()name - an unique name for the dictionary.description - a brief description of the dictionarywordListReader - a Reader pointing to a word listisNormalised - indicates whether the word list should be normalised to lower case.Dictionaryjava.io.FileNotFoundException - if the word list file cannot be foundjava.io.IOException - if a problem is encountered reading the word listpublic void setCostThreshold(int maximumCost)
maximumCost - the maximum cost of a transformation to an
alternative spelling.public void setMaximumSuggestions(int maximumSuggestions)
The new threshold only applies to dictionaries created by the manager after it has been set.
maximumSuggestions - the maximum number of suggested alternative
spellings to be returned by a dictionary.public DictionarySet dictionarySet()
A copy of the current set of dictionaries and the state of the configuration variables is returned. Further changes to the configuration and number of dictionaries made through the manager object should not affect the copy.
public void reset()