| java.lang.Object org.apache.commons.codec.language.Metaphone
Metaphone | public class Metaphone implements StringEncoder(Code) | | Encodes a string into a metaphone value.
Initial Java implementation by William B. Brogden. December, 1997.
Permission given by wbrogden for code to be used anywhere.
Hanging on the Metaphone by Lawrence Philips in Computer Language of Dec. 1990, p
39.
author: Apache Software Foundation version: $Id: Metaphone.java,v 1.20 2004/06/05 18:32:04 ggregory Exp $ |
Metaphone | public Metaphone()(Code) | | Creates an instance of the Metaphone encoder
|
encode | public Object encode(Object pObject) throws EncoderException(Code) | | Encodes an Object using the metaphone algorithm. This method
is provided in order to satisfy the requirements of the
Encoder interface, and will throw an EncoderException if the
supplied object is not of type java.lang.String.
Parameters: pObject - Object to encode An object (or type java.lang.String) containing the metaphone code which corresponds to the String supplied. throws: EncoderException - if the parameter supplied is notof type java.lang.String |
encode | public String encode(String pString)(Code) | | Encodes a String using the Metaphone algorithm.
Parameters: pString - String object to encode The metaphone code corresponding to the String supplied |
getMaxCodeLen | public int getMaxCodeLen()(Code) | | Returns the maxCodeLen.
int |
isMetaphoneEqual | public boolean isMetaphoneEqual(String str1, String str2)(Code) | | Tests is the metaphones of two strings are identical.
Parameters: str1 - First of two strings to compare Parameters: str2 - Second of two strings to compare true if the metaphones of these strings are identical, false otherwise. |
metaphone | public String metaphone(String txt)(Code) | | Find the metaphone value of a String. This is similar to the
soundex algorithm, but better at finding similar sounding words.
All input is converted to upper case.
Limitations: Input format is expected to be a single ASCII word
with only characters in the A - Z range, no punctuation or numbers.
Parameters: txt - String to find the metaphone code for A metaphone code corresponding to the String supplied |
setMaxCodeLen | public void setMaxCodeLen(int maxCodeLen)(Code) | | Sets the maxCodeLen.
Parameters: maxCodeLen - The maxCodeLen to set |
|
|