com.sun.mdm.index.phonetic.impl
Class RefinedSoundex

java.lang.Object
  extended bycom.sun.mdm.index.phonetic.impl.RefinedSoundex
All Implemented Interfaces:
PhoneticEncoder

public class RefinedSoundex
extends java.lang.Object
implements PhoneticEncoder

Encodes a string into a refined soundex value. A refined soundex code is optimized for spell checking word. "Soundex" method originally developed by Margaret Odell and Robert Russell


Field Summary
static java.lang.String ENCODING_TYPE
          informative String about the encoding type this encoder does
static RefinedSoundex US_ENGLISH
          This static variable contains an instance of the RefinedSoundex using the US_ENGLISH mapping.
static char[] US_ENGLISH_MAPPING
          RefinedSoundex is *refined* for a number of reasons one being that the mappings have been altered.
 
Constructor Summary
RefinedSoundex()
          Creates an instance of the RefinedSoundex object using the default US English mapping.
RefinedSoundex(char[] mapping)
          Creates a refined soundex instance using a custom mapping.
 
Method Summary
 java.lang.Object encode(java.lang.Object pObject)
          Encodes an Object using the refined soundex algorithm.
 java.lang.String encode(java.lang.String pString)
          Encodes a String using the refined soundex algorithm.
 java.lang.String encode(java.lang.String value, java.lang.String domain)
          Encode the value using Soundex.
 java.lang.String getEncodingType()
           
 java.lang.String soundex(java.lang.String str)
          Retreives the Refined Soundex code for a given String object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING_TYPE

public static final java.lang.String ENCODING_TYPE
informative String about the encoding type this encoder does

See Also:
Constant Field Values

US_ENGLISH

public static final RefinedSoundex US_ENGLISH
This static variable contains an instance of the RefinedSoundex using the US_ENGLISH mapping.


US_ENGLISH_MAPPING

public static final char[] US_ENGLISH_MAPPING
RefinedSoundex is *refined* for a number of reasons one being that the mappings have been altered. This implementation contains default mappings for US English.

Constructor Detail

RefinedSoundex

public RefinedSoundex()
Creates an instance of the RefinedSoundex object using the default US English mapping.


RefinedSoundex

public RefinedSoundex(char[] mapping)
Creates a refined soundex instance using a custom mapping. This constructor can be used to customize the mapping, and/or possibly provide an internationalized mapping for a non-Western character set.

Parameters:
mapping - Mapping array to use when finding the corresponding code for a given character
Method Detail

encode

public java.lang.Object encode(java.lang.Object pObject)
                        throws PhoneticEncoderException
Encodes an Object using the refined soundex algorithm. This method is provided in order to satisfy the requirements of the Encoder interface, and will throw an PhoneticEncoderException if the supplied object is not of type java.lang.String.

Parameters:
pObject - Object to encode
Returns:
An object (or type java.lang.String) containing the refined soundex code which corresponds to the String supplied.
Throws:
PhoneticEncoderException - if the parameter supplied is not of type java.lang.String

encode

public java.lang.String encode(java.lang.String pString)
Encodes a String using the refined soundex algorithm.

Specified by:
encode in interface PhoneticEncoder
Parameters:
pString - A String object to encode
Returns:
A Soundex code corresponding to the String supplied
Throws:
PhoneticEncoderException - throws exception if there is an encoding-specific problem

encode

public java.lang.String encode(java.lang.String value,
                               java.lang.String domain)
Encode the value using Soundex.

Specified by:
encode in interface PhoneticEncoder
Parameters:
value - String to encode
domain - locality
Returns:
An encoded String
Throws:
PhoneticEncoderException - thrown if there is an exception during the encoding process.

getEncodingType

public java.lang.String getEncodingType()
Description copied from interface: PhoneticEncoder
Getter for the encoding type

Specified by:
getEncodingType in interface PhoneticEncoder
Returns:
the encoding type the Phonetic Encoder implements (such as NYSIIS or Soundex) This value is for information purposes and is not enforced to be of the same value as the 'encoding type' listed in the PhoneticEncodersConfiguration for the encoder class instance. As a result it should not be used for calls to the Phoneticizer.

soundex

public java.lang.String soundex(java.lang.String str)
Retreives the Refined Soundex code for a given String object.

Parameters:
str - String to encode using the Refined Soundex algorithm
Returns:
A soundex code for the String supplied


Sun Microsystems, Inc.