com.swabunga.spell.engine

Class Configuration

public abstract class Configuration extends Object

The various settings used to control how a spell checker works are read from here. Includes the COST_* constants that decide how to figure the cost of converting one word to another in the EditDistance class.

Also includes SPELL_* constants that control how misspellings are detected, for example, how to handle mixed-case words, etc.

Author: aim4min

See Also: EditDistance

Field Summary
static StringCOST_CHANGE_CASE
used by EditDistance: the cost of having to change case, for example, from i to I.
static StringCOST_INSERT_CHAR
used by EditDistance: the cost of having to insert a character
(integer greater than 0)
static StringCOST_REMOVE_CHAR
used by EditDistance: the cost of having to remove a character
(integer greater than 0)
static StringCOST_SUBST_CHARS
used by EditDistance: the cost of having to substitute one character for another for the sub value to ever be used, it should be smaller than the COST_REMOVE_CHAR or COST_INSERT_CHAR values
(integer greater than 0)
static StringCOST_SWAP_CHARS
used by EditDistance: the cost of having to swap two adjoining characters for the swap value to ever be used, it should be smaller than the COST_REMOVE_CHAR or COST_INSERT_CHAR values
(integer greater than 0)
static StringSPELL_IGNOREDIGITWORDS
words that have digits in them are not spell checked, example: "mach5"
(boolean)
static StringSPELL_IGNOREINTERNETADDRESSES
words that look like an Internet address are not spell checked, example: "http://www.google.com"
(boolean)
static StringSPELL_IGNOREMIXEDCASE
words that have mixed case are not spell checked, example: "SpellChecker"
(boolean)
static StringSPELL_IGNOREMULTIPLEWORDS
I don't know what this does.
static StringSPELL_IGNORESENTENCECAPITALIZATION
the first word of a sentence is expected to start with an upper case letter
(boolean)
static StringSPELL_IGNOREUPPERCASE
words that are all upper case are not spell checked, example: "CIA"
(boolean)
static StringSPELL_THRESHOLD
the maximum cost of suggested spelling.
Method Summary
abstract booleangetBoolean(String key)
Gets one of the boolean constants
static ConfigurationgetConfiguration()
gets a new default Configuration
static ConfigurationgetConfiguration(String className)
Returns a new instance of a Configuration class
abstract intgetInteger(String key)
Gets one of the integer constants
abstract voidsetBoolean(String key, boolean value)
Sets one of the boolean constants
abstract voidsetInteger(String key, int value)
Sets one of the integer constants

Field Detail

COST_CHANGE_CASE

public static final String COST_CHANGE_CASE
used by EditDistance: the cost of having to change case, for example, from i to I.
(integer greater than 0)

COST_INSERT_CHAR

public static final String COST_INSERT_CHAR
used by EditDistance: the cost of having to insert a character
(integer greater than 0)

COST_REMOVE_CHAR

public static final String COST_REMOVE_CHAR
used by EditDistance: the cost of having to remove a character
(integer greater than 0)

COST_SUBST_CHARS

public static final String COST_SUBST_CHARS
used by EditDistance: the cost of having to substitute one character for another for the sub value to ever be used, it should be smaller than the COST_REMOVE_CHAR or COST_INSERT_CHAR values
(integer greater than 0)

COST_SWAP_CHARS

public static final String COST_SWAP_CHARS
used by EditDistance: the cost of having to swap two adjoining characters for the swap value to ever be used, it should be smaller than the COST_REMOVE_CHAR or COST_INSERT_CHAR values
(integer greater than 0)

SPELL_IGNOREDIGITWORDS

public static final String SPELL_IGNOREDIGITWORDS
words that have digits in them are not spell checked, example: "mach5"
(boolean)

SPELL_IGNOREINTERNETADDRESSES

public static final String SPELL_IGNOREINTERNETADDRESSES
words that look like an Internet address are not spell checked, example: "http://www.google.com"
(boolean)

SPELL_IGNOREMIXEDCASE

public static final String SPELL_IGNOREMIXEDCASE
words that have mixed case are not spell checked, example: "SpellChecker"
(boolean)

SPELL_IGNOREMULTIPLEWORDS

public static final String SPELL_IGNOREMULTIPLEWORDS
I don't know what this does. It doesn't seem to be used
(boolean)

SPELL_IGNORESENTENCECAPITALIZATION

public static final String SPELL_IGNORESENTENCECAPITALIZATION
the first word of a sentence is expected to start with an upper case letter
(boolean)

SPELL_IGNOREUPPERCASE

public static final String SPELL_IGNOREUPPERCASE
words that are all upper case are not spell checked, example: "CIA"
(boolean)

SPELL_THRESHOLD

public static final String SPELL_THRESHOLD
the maximum cost of suggested spelling. Any suggestions that cost more are thrown away
integer greater than 1)

Method Detail

getBoolean

public abstract boolean getBoolean(String key)
Gets one of the boolean constants

Parameters: key one of the boolean constants defined in this class

Returns: boolean value of the setting

getConfiguration

public static final Configuration getConfiguration()
gets a new default Configuration

Returns: Configuration

getConfiguration

public static final Configuration getConfiguration(String className)
Returns a new instance of a Configuration class

Parameters: className - the class to return, must be based on Configuration

Returns: Configuration

getInteger

public abstract int getInteger(String key)
Gets one of the integer constants

Parameters: key one of the integer constants defined in this class

Returns: int value of the setting

setBoolean

public abstract void setBoolean(String key, boolean value)
Sets one of the boolean constants

Parameters: key one of the boolean constants defined in this class value new boolean value of this setting

setInteger

public abstract void setInteger(String key, int value)
Sets one of the integer constants

Parameters: key one of the integer constants defined in this class value new integer value of the constant