org.apache.commons.codec.language
Class Soundex

java.lang.Object
  extended by org.apache.commons.codec.language.Soundex
All Implemented Interfaces:
Encoder, StringEncoder

public class Soundex
extends Object
implements StringEncoder

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 http://www.bluepoof.com/Soundex/info2.html

TODO : Internationalize Exception Messages

Version:
$Revision: 3.0 $ $Date: 2004/07/24 13:22:05 $
Author:
bayard@generationjava.com, tobrien@transolutions.net

Field Summary
static Soundex US_ENGLISH
           
static char[] US_ENGLISH_MAPPING
           
 
Constructor Summary
Soundex()
           
Soundex(char[] mapping)
           
 
Method Summary
 Object encode(Object pObject)
          All encoders allow a library-user to pass an Object and get an Object in return.
 String encode(String pString)
          Encode a String and produce a String.
 int getMaxLength()
          Returns the maxLength.
 void setMaxLength(int maxLength)
          Sets the maxLength.
 String soundex(String str)
          Get the SoundEx value of a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

US_ENGLISH_MAPPING

public static final char[] US_ENGLISH_MAPPING

US_ENGLISH

public static final Soundex US_ENGLISH
Constructor Detail

Soundex

public Soundex()

Soundex

public Soundex(char[] mapping)
Method Detail

soundex

public String soundex(String str)
Get the SoundEx value of a string. This implementation is taken from the code-snippers on http://www.sourceforge.net/


encode

public Object encode(Object pObject)
              throws EncoderException
Description copied from interface: Encoder
All encoders allow a library-user to pass an Object and get an Object in return. This function encodes an "Object" - returning the encoded content as an Object. The Objects here may just be byte[] or Strings depending on the implementation used.

Specified by:
encode in interface Encoder
Parameters:
pObject - An object ot encode
Returns:
An "encoded" Object
Throws:
EncoderException - an encoder exception is thrown if the encoder experiences a failure condition during the encoding process.

encode

public String encode(String pString)
              throws EncoderException
Description copied from interface: StringEncoder
Encode a String and produce a String.

Specified by:
encode in interface StringEncoder
Parameters:
pString - a String to encode
Returns:
the encoded String
Throws:
EncoderException - thrown if there is an error conidition during the Encoding process.

getMaxLength

public int getMaxLength()
Returns the maxLength. Standard Soundex

Returns:
int

setMaxLength

public void setMaxLength(int maxLength)
Sets the maxLength.

Parameters:
maxLength - The maxLength to set


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.