org.apache.commons.codec.language
public class Metaphone extends Object implements StringEncoder
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.
Version: $Id: Metaphone.java 130375 2004-06-05 18:32:04Z ggregory $
Field Summary | |
---|---|
String | frontv
Variable used in Metaphone algorithm |
int | maxCodeLen
The max code length for metaphone is 4 |
String | varson
Variable used in Metaphone algorithm |
String | vowels
Five values in the English language |
Constructor Summary | |
---|---|
Metaphone()
Creates an instance of the Metaphone encoder |
Method Summary | |
---|---|
Object | encode(Object pObject)
Encodes an Object using the metaphone algorithm. |
String | encode(String pString)
Encodes a String using the Metaphone algorithm.
|
int | getMaxCodeLen()
Returns the maxCodeLen. |
boolean | isLastChar(int wdsz, int n) |
boolean | isMetaphoneEqual(String str1, String str2)
Tests is the metaphones of two strings are identical.
|
boolean | isNextChar(StringBuffer string, int index, char c) |
boolean | isPreviousChar(StringBuffer string, int index, char c) |
boolean | isVowel(StringBuffer string, int index) |
String | metaphone(String txt)
Find the metaphone value of a String. |
boolean | regionMatch(StringBuffer string, int index, String test) |
void | setMaxCodeLen(int maxCodeLen)
Sets the maxCodeLen. |
Parameters: pObject Object to encode
Returns: An object (or type java.lang.String) containing the metaphone code which corresponds to the String supplied.
Throws: EncoderException if the parameter supplied is not of type java.lang.String
Parameters: pString String object to encode
Returns: The metaphone code corresponding to the String supplied
Returns: int
Parameters: str1 First of two strings to compare str2 Second of two strings to compare
Returns: true if the metaphones of these strings are identical, false otherwise.
Parameters: txt String to find the metaphone code for
Returns: A metaphone code corresponding to the String supplied
Parameters: maxCodeLen The maxCodeLen to set