Encodes a string into a double metaphone value. More...
This Implementation is based on the algorithm by Lawrence Philips.
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. */
Classes | |
class | DoubleMetaphoneResult |
Inner class for storing results, since there is the optional alternate encoding. More... | |
Public Member Functions | |
DoubleMetaphone () | |
Creates an instance of this DoubleMetaphone encoder. | |
String | doubleMetaphone (String value) |
Encode a value with Double Metaphone. More... | |
String | doubleMetaphone (String value, boolean alternate) |
Encode a value with Double Metaphone, optionally using the alternate encoding. More... | |
Object | encode (Object obj) throws EncoderException |
Encode the value using DoubleMetaphone. More... | |
String | encode (String value) |
Encode the value using DoubleMetaphone. More... | |
boolean | isDoubleMetaphoneEqual (String value1, String value2) |
Check if the Double Metaphone values of two String values are equal. More... | |
boolean | isDoubleMetaphoneEqual (String value1, String value2, boolean alternate) |
Check if the Double Metaphone values of two String values are equal, optionally using the alternate value. More... | |
int | getMaxCodeLen () |
Returns the maxCodeLen. More... | |
void | setMaxCodeLen (int maxCodeLen) |
Sets the maxCodeLen. More... | |
Protected Member Functions | |
char | charAt (String value, int index) |
Gets the character at index index if available, otherwise it returns Character.MIN_VALUE so that there is some sort of a default. | |
Static Protected Member Functions | |
static boolean | contains (String value, int start, int length, String[] criteria) |
Determines whether value contains any of the criteria starting at index start and matching up to length length | |
Protected Attributes | |
int | maxCodeLen = 4 |
Maximum length of an encoding, default is 4. | |
String doubleMetaphone | ( | String | value | ) |
value | String to encode |
String doubleMetaphone | ( | String | value, |
boolean | alternate | ||
) |
value | String to encode |
alternate | use alternate encode |
Object encode | ( | Object | obj | ) | throws EncoderException |
It will only work if obj
is a String
(like Metaphone
).
obj | Object to encode (should be of type String) |
EncoderException | encode parameter is not of type String |
Implements Encoder.
String encode | ( | String | value | ) |
boolean isDoubleMetaphoneEqual | ( | String | value1, |
String | value2 | ||
) |
value1 | The left-hand side of the encoded String. |
value2 | The right-hand side of the encoded String. |
true
if the encoded String
s are equal; false
otherwise. boolean isDoubleMetaphoneEqual | ( | String | value1, |
String | value2, | ||
boolean | alternate | ||
) |
value1 | The left-hand side of the encoded String. |
value2 | The right-hand side of the encoded String. |
alternate | use the alternate value if true . |
true
if the encoded String
s are equal; false
otherwise. int getMaxCodeLen | ( | ) |
void setMaxCodeLen | ( | int | maxCodeLen | ) |
maxCodeLen | The maxCodeLen to set |