Encodes a string into a Refined Soundex value. More...
A refined soundex code is optimized for spell checking words. Soundex method originally developed by Margaret Odell and Robert Russell.
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 | |
RefinedSoundex () | |
Creates an instance of the RefinedSoundex object using the default US English mapping. | |
RefinedSoundex (char[] mapping) | |
Creates a refined soundex instance using a custom mapping. More... | |
int | difference (String s1, String s2) throws EncoderException |
Returns the number of characters in the two encoded Strings that are the same. More... | |
Object | encode (Object pObject) throws EncoderException |
Encodes an Object using the refined soundex algorithm. More... | |
String | encode (String pString) |
Encodes a String using the refined soundex algorithm. More... | |
String | soundex (String str) |
Retreives the Refined Soundex code for a given String object. More... | |
Static Public Attributes | |
static final RefinedSoundex | US_ENGLISH = new RefinedSoundex() |
This static variable contains an instance of the RefinedSoundex using the US_ENGLISH mapping. | |
static final char[] | US_ENGLISH_MAPPING = "01360240043788015936020505".toCharArray() |
RefinedSoundex is *refined* for a number of reasons one being that the mappings have been altered. More... | |
RefinedSoundex | ( | char[] | mapping | ) |
This constructor can be used to customize the mapping, and/or possibly provide an internationalized mapping for a non-Western character set.
mapping | Mapping array to use when finding the corresponding code for a given character |
int difference | ( | String | s1, |
String | s2 | ||
) | throws EncoderException |
This return value ranges from 0 to the length of the shortest encoded String: 0 indicates little or no similarity, and 4 out of 4 (for example) indicates strong similarity or identical values. For refined Soundex, the return value can be greater than 4.
s1 | A String that will be encoded and compared. |
s2 | A String that will be encoded and compared. |
EncoderException | if an error occurs encoding one of the strings |
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 | A String object to encode |
Implements StringEncoder.
String soundex | ( | String | str | ) |
str | String to encode using the Refined Soundex algorithm |
|
static |
This implementation contains default mappings for US English.