| |
|
| java.lang.Object org.apache.commons.codec.language.RefinedSoundex
RefinedSoundex | public class RefinedSoundex implements StringEncoder(Code) | | Encodes a string into a Refined Soundex value. A refined soundex code is
optimized for spell checking words. Soundex method originally developed by
Margaret Odell and Robert Russell.
author: Apache Software Foundation version: $Id: RefinedSoundex.java,v 1.21 2004/06/05 18:32:04 ggregory Exp $ |
Field Summary | |
final public static RefinedSoundex | US_ENGLISH This static variable contains an instance of the RefinedSoundex using
the US_ENGLISH mapping. | final public static char[] | US_ENGLISH_MAPPING RefinedSoundex is *refined* for a number of reasons one being that the
mappings have been altered. |
Constructor Summary | |
public | RefinedSoundex() Creates an instance of the RefinedSoundex object using the default US
English mapping. | public | RefinedSoundex(char[] mapping) Creates a refined soundex instance using a custom mapping. |
Method Summary | |
public int | difference(String s1, String s2) Returns the number of characters in the two encoded Strings that are the
same. | public Object | encode(Object pObject) Encodes an Object using the refined soundex algorithm. | public String | encode(String pString) Encodes a String using the refined soundex algorithm. | char | getMappingCode(char c) Returns the mapping code for a given character. | public String | soundex(String str) Retreives the Refined Soundex code for a given String object. |
US_ENGLISH | final public static RefinedSoundex US_ENGLISH(Code) | | This static variable contains an instance of the RefinedSoundex using
the US_ENGLISH mapping.
|
US_ENGLISH_MAPPING | final public static char[] US_ENGLISH_MAPPING(Code) | | RefinedSoundex is *refined* for a number of reasons one being that the
mappings have been altered. This implementation contains default
mappings for US English.
|
RefinedSoundex | public RefinedSoundex()(Code) | | Creates an instance of the RefinedSoundex object using the default US
English mapping.
|
RefinedSoundex | public RefinedSoundex(char[] mapping)(Code) | | Creates a refined soundex instance using a custom mapping. This
constructor can be used to customize the mapping, and/or possibly
provide an internationalized mapping for a non-Western character set.
Parameters: mapping - Mapping array to use when finding the corresponding code fora given character |
difference | public int difference(String s1, String s2) throws EncoderException(Code) | | Returns the number of characters in the two encoded Strings that are the
same. 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.
Parameters: s1 - A String that will be encoded and compared. Parameters: s2 - A String that will be encoded and compared. The number of characters in the two encoded Strings that are thesame from 0 to to the length of the shortest encoded String. See Also: SoundexUtils.difference(StringEncoderStringString) See Also:
* MS T-SQL DIFFERENCE throws: EncoderException - if an error occurs encoding one of the strings since: 1.3 |
encode | public Object encode(Object pObject) throws EncoderException(Code) | | Encodes an Object using the refined soundex 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.
Parameters: pObject - Object to encode An object (or type java.lang.String) containing the refinedsoundex code which corresponds to the String supplied. throws: EncoderException - if the parameter supplied is not of type java.lang.String |
encode | public String encode(String pString)(Code) | | Encodes a String using the refined soundex algorithm.
Parameters: pString - A String object to encode A Soundex code corresponding to the String supplied |
getMappingCode | char getMappingCode(char c)(Code) | | Returns the mapping code for a given character. The mapping codes are
maintained in an internal char array named soundexMapping, and the
default values of these mappings are US English.
Parameters: c - char to get mapping for A character (really a numeral) to return for the given char |
soundex | public String soundex(String str)(Code) | | Retreives the Refined Soundex code for a given String object.
Parameters: str - String to encode using the Refined Soundex algorithm A soundex code for the String supplied |
|
|
|