Class Configuration

  • Direct Known Subclasses:
    PropertyConfiguration

    public abstract class Configuration
    extends java.lang.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

      Fields 
      Modifier and Type Field Description
      static java.lang.String COST_CHANGE_CASE
      used by EditDistance: the cost of having to change case, for example, from i to I.
      static java.lang.String COST_INSERT_CHAR
      used by EditDistance: the cost of having to insert a character
      (integer greater than 0)
      static java.lang.String COST_REMOVE_CHAR
      used by EditDistance: the cost of having to remove a character
      (integer greater than 0)
      static java.lang.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)
      static java.lang.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)
      static java.lang.String SPELL_IGNOREDIGITWORDS
      words that have digits in them are not spell checked, example: "mach5"
      (boolean)
      static java.lang.String SPELL_IGNOREINTERNETADDRESSES
      words that look like an Internet address are not spell checked, example: "http://www.google.com"
      (boolean)
      static java.lang.String SPELL_IGNOREMIXEDCASE
      words that have mixed case are not spell checked, example: "SpellChecker"
      (boolean)
      static java.lang.String SPELL_IGNOREMULTIPLEWORDS
      I don't know what this does.
      static java.lang.String SPELL_IGNORESENTENCECAPITALIZATION
      the first word of a sentence is expected to start with an upper case letter
      (boolean)
      static java.lang.String SPELL_IGNOREUPPERCASE
      words that are all upper case are not spell checked, example: "CIA"
      (boolean)
      static java.lang.String SPELL_THRESHOLD
      the maximum cost of suggested spelling.
    • Constructor Summary

      Constructors 
      Constructor Description
      Configuration()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract boolean getBoolean​(java.lang.String key)
      Gets one of the boolean constants
      static Configuration getConfiguration()
      gets a new default Configuration
      static Configuration getConfiguration​(java.lang.String className)
      Returns a new instance of a Configuration class
      abstract int getInteger​(java.lang.String key)
      Gets one of the integer constants
      abstract void setBoolean​(java.lang.String key, boolean value)
      Sets one of the boolean constants
      abstract void setInteger​(java.lang.String key, int value)
      Sets one of the integer constants
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COST_REMOVE_CHAR

        public static final java.lang.String COST_REMOVE_CHAR
        used by EditDistance: the cost of having to remove a character
        (integer greater than 0)
        See Also:
        Constant Field Values
      • COST_INSERT_CHAR

        public static final java.lang.String COST_INSERT_CHAR
        used by EditDistance: the cost of having to insert a character
        (integer greater than 0)
        See Also:
        Constant Field Values
      • COST_SWAP_CHARS

        public static final java.lang.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)
        See Also:
        Constant Field Values
      • COST_CHANGE_CASE

        public static final java.lang.String COST_CHANGE_CASE
        used by EditDistance: the cost of having to change case, for example, from i to I.
        (integer greater than 0)
        See Also:
        Constant Field Values
      • COST_SUBST_CHARS

        public static final java.lang.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)
        See Also:
        Constant Field Values
      • SPELL_THRESHOLD

        public static final java.lang.String SPELL_THRESHOLD
        the maximum cost of suggested spelling. Any suggestions that cost more are thrown away
        integer greater than 1)
        See Also:
        Constant Field Values
      • SPELL_IGNOREUPPERCASE

        public static final java.lang.String SPELL_IGNOREUPPERCASE
        words that are all upper case are not spell checked, example: "CIA"
        (boolean)
        See Also:
        Constant Field Values
      • SPELL_IGNOREMIXEDCASE

        public static final java.lang.String SPELL_IGNOREMIXEDCASE
        words that have mixed case are not spell checked, example: "SpellChecker"
        (boolean)
        See Also:
        Constant Field Values
      • SPELL_IGNOREINTERNETADDRESSES

        public static final java.lang.String SPELL_IGNOREINTERNETADDRESSES
        words that look like an Internet address are not spell checked, example: "http://www.google.com"
        (boolean)
        See Also:
        Constant Field Values
      • SPELL_IGNOREDIGITWORDS

        public static final java.lang.String SPELL_IGNOREDIGITWORDS
        words that have digits in them are not spell checked, example: "mach5"
        (boolean)
        See Also:
        Constant Field Values
      • SPELL_IGNOREMULTIPLEWORDS

        public static final java.lang.String SPELL_IGNOREMULTIPLEWORDS
        I don't know what this does. It doesn't seem to be used
        (boolean)
        See Also:
        Constant Field Values
      • SPELL_IGNORESENTENCECAPITALIZATION

        public static final java.lang.String SPELL_IGNORESENTENCECAPITALIZATION
        the first word of a sentence is expected to start with an upper case letter
        (boolean)
        See Also:
        Constant Field Values
    • Constructor Detail

      • Configuration

        public Configuration()
    • Method Detail

      • getInteger

        public abstract int getInteger​(java.lang.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
      • getBoolean

        public abstract boolean getBoolean​(java.lang.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
      • setInteger

        public abstract void setInteger​(java.lang.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
      • setBoolean

        public abstract void setBoolean​(java.lang.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
      • getConfiguration

        public static final Configuration getConfiguration()
        gets a new default Configuration
        Returns:
        Configuration
      • getConfiguration

        public static final Configuration getConfiguration​(java.lang.String className)
        Returns a new instance of a Configuration class
        Parameters:
        className - - the class to return, must be based on Configuration
        Returns:
        Configuration