|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.codec.language.Metaphone
Encodes a string into a metaphone value. The initial Java implementation, William B. Brogden. December, 1997 Permission given by wbrogden for code to be used anywhere. "Hanging on the Metaphone" by Lawrence Philips Computer Language of Dec. 1990, p 39
Field Summary | |
private String |
frontv
Variable used in Metaphone algorithm |
private int |
maxCodeLen
The max code length for metaphone is 4 |
private String |
varson
Variable used in Metaphone algorithm |
private 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 |
isMetaphoneEqual(String str1,
String str2)
Tests is the metaphones of two strings are identical. |
String |
metaphone(String txt)
Find the metaphone value of a String. |
void |
setMaxCodeLen(int maxCodeLen)
Sets the maxCodeLen. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private String vowels
private String frontv
private String varson
private int maxCodeLen
Constructor Detail |
public Metaphone()
Method Detail |
public String metaphone(String txt)
txt
- String to find the metaphone code for
public Object encode(Object pObject) throws EncoderException
encode
in interface Encoder
pObject
- Object to encode
EncoderException
- if the parameter supplied is not
of type java.lang.Stringpublic String encode(String pString)
encode
in interface StringEncoder
pString
- String object to encode
EncoderException
- thrown if a Metaphone specific exception
is encountered.public boolean isMetaphoneEqual(String str1, String str2)
str1
- First of two strings to comparestr2
- Second of two strings to compare
public int getMaxCodeLen()
public void setMaxCodeLen(int maxCodeLen)
maxCodeLen
- The maxCodeLen to set
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |