Encodes a string into a metaphone value. More...
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.
The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Public Member Functions | |
Metaphone () | |
Creates an instance of the Metaphone encoder. | |
String | metaphone (String txt) |
Find the metaphone value of a String. More... | |
Object | encode (Object pObject) throws EncoderException |
Encodes an Object using the metaphone algorithm. More... | |
String | encode (String pString) |
Encodes a String using the Metaphone algorithm. More... | |
boolean | isMetaphoneEqual (String str1, String str2) |
Tests is the metaphones of two strings are identical. More... | |
int | getMaxCodeLen () |
Returns the maxCodeLen. More... | |
void | setMaxCodeLen (int maxCodeLen) |
Sets the maxCodeLen. More... | |
String metaphone | ( | String | txt | ) |
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 |
Object encode | ( | Object | pObject | ) | throws EncoderException |
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 |
Implements Encoder.
String encode | ( | String | pString | ) |
pString | String object to encode |
Implements StringEncoder.
boolean isMetaphoneEqual | ( | String | str1, |
String | str2 | ||
) |
str1 | First of two strings to compare |
str2 | Second of two strings to compare |
int getMaxCodeLen | ( | ) |
void setMaxCodeLen | ( | int | maxCodeLen | ) |
maxCodeLen | The maxCodeLen to set |