java.lang.Object | |
↳ | org.apache.commons.codec.language.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.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an instance of the Metaphone encoder
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Encodes an Object using the metaphone algorithm.
| |||||||||||
Encodes a String using the Metaphone algorithm.
| |||||||||||
Returns the maxCodeLen.
| |||||||||||
Tests is the metaphones of two strings are identical.
| |||||||||||
Find the metaphone value of a String.
| |||||||||||
Sets the maxCodeLen.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.apache.commons.codec.Encoder
| |||||||||||
From interface
org.apache.commons.codec.StringEncoder
|
Creates an instance of the Metaphone encoder
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.
pObject | Object to encode |
---|
EncoderException | if the parameter supplied is not of type java.lang.String |
---|
Encodes a String using the Metaphone algorithm.
pString | String object to encode |
---|
Returns the maxCodeLen.
Tests is the metaphones of two strings are identical.
str1 | First of two strings to compare |
---|---|
str2 | Second of two strings to compare |
true
if the metaphones of these strings are identical,
false
otherwise.
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.
txt | String to find the metaphone code for |
---|
Sets the maxCodeLen.
maxCodeLen | The maxCodeLen to set |
---|