|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.codec.language.Metaphone
public class Metaphone
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.
Note, that this does not match the algorithm that ships with PHP, or the algorithm found in the Perl Text:Metaphone-1.96. They have had undocumented changes from the originally published algorithm. For more information, see CODEC-57.
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 |
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
public boolean isMetaphoneEqual(String str1, String str2)
str1
- First of two strings to comparestr2
- Second of two strings to compare
true
if the metaphones of these strings are identical,
false
otherwise.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 |