org.apache.commons.codec.language
public class DoubleMetaphone extends Object implements StringEncoder
Version: $Id: DoubleMetaphone.java 130375 2004-06-05 18:32:04Z ggregory $
| Nested Class Summary | |
|---|---|
| class | DoubleMetaphone.DoubleMetaphoneResult
Inner class for storing results, since there is the optional alternate
encoding. |
| Field Summary | |
|---|---|
| static String[] | ES_EP_EB_EL_EY_IB_IL_IN_IE_EI_ER |
| static String[] | L_R_N_M_B_H_F_V_W_SPACE |
| static String[] | L_T_K_S_N_M_B_Z |
| protected int | maxCodeLen
Maximum length of an encoding, default is 4 |
| static String[] | SILENT_START
Prefixes when present which are not pronounced |
| static String | VOWELS
"Vowels" to test for |
| Constructor Summary | |
|---|---|
| DoubleMetaphone()
Creates an instance of this DoubleMetaphone encoder | |
| Method Summary | |
|---|---|
| protected 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 |
| String | cleanInput(String input)
Cleans the input |
| boolean | conditionC0(String value, int index)
Complex condition 0 for 'C' |
| boolean | conditionCH0(String value, int index)
Complex condition 0 for 'CH' |
| boolean | conditionCH1(String value, int index)
Complex condition 1 for 'CH' |
| boolean | conditionL0(String value, int index)
Complex condition 0 for 'L' |
| boolean | conditionM0(String value, int index)
Complex condition 0 for 'M' |
| static boolean | contains(String value, int start, int length, String criteria)
Shortcut method with 1 criteria |
| static boolean | contains(String value, int start, int length, String criteria1, String criteria2)
Shortcut method with 2 criteria |
| static boolean | contains(String value, int start, int length, String criteria1, String criteria2, String criteria3)
Shortcut method with 3 criteria |
| static boolean | contains(String value, int start, int length, String criteria1, String criteria2, String criteria3, String criteria4)
Shortcut method with 4 criteria |
| static boolean | contains(String value, int start, int length, String criteria1, String criteria2, String criteria3, String criteria4, String criteria5)
Shortcut method with 5 criteria |
| static boolean | contains(String value, int start, int length, String criteria1, String criteria2, String criteria3, String criteria4, String criteria5, String criteria6)
Shortcut method with 6 criteria |
| protected 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 |
| String | doubleMetaphone(String value)
Encode a value with Double Metaphone
|
| String | doubleMetaphone(String value, boolean alternate)
Encode a value with Double Metaphone, optionally using the alternate
encoding.
|
| Object | encode(Object obj)
Encode the value using DoubleMetaphone. |
| String | encode(String value)
Encode the value using DoubleMetaphone.
|
| int | getMaxCodeLen()
Returns the maxCodeLen. |
| int | handleAEIOUY(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'A', 'E', 'I', 'O', 'U', and 'Y' cases |
| int | handleC(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'C' cases |
| int | handleCC(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'CC' cases |
| int | handleCH(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'CH' cases |
| int | handleD(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'D' cases |
| int | handleG(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index, boolean slavoGermanic)
Handles 'G' cases |
| int | handleGH(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'GH' cases |
| int | handleH(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'H' cases |
| int | handleJ(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index, boolean slavoGermanic)
Handles 'J' cases |
| int | handleL(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'L' cases |
| int | handleP(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'P' cases |
| int | handleR(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index, boolean slavoGermanic)
Handles 'R' cases |
| int | handleS(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index, boolean slavoGermanic)
Handles 'S' cases |
| int | handleSC(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'SC' cases |
| int | handleT(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'T' cases |
| int | handleW(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'W' cases |
| int | handleX(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index)
Handles 'X' cases |
| int | handleZ(String value, DoubleMetaphone.DoubleMetaphoneResult result, int index, boolean slavoGermanic)
Handles 'Z' cases |
| boolean | isDoubleMetaphoneEqual(String value1, String value2)
Check if the Double Metaphone values of two String values
are equal.
|
| 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.
|
| boolean | isSilentStart(String value)
Determines whether or not the value starts with a silent letter. |
| boolean | isSlavoGermanic(String value)
Determines whether or not a value is of slavo-germanic orgin. |
| boolean | isVowel(char ch)
Determines whether or not a character is a vowel or not |
| void | setMaxCodeLen(int maxCodeLen)
Sets the maxCodeLen. |
index if available, otherwise
it returns Character.MIN_VALUE so that there is some sort
of a defaultvalue contains any of the criteria
starting
at index start and matching up to length lengthParameters: value String to encode
Returns: an encoded string
Parameters: value String to encode alternate use alternate encode
Returns: an encoded string
obj is a String (like Metaphone).
Parameters: obj Object to encode (should be of type String)
Returns: An encoded Object (will be of type String)
Throws: EncoderException encode parameter is not of type String
Parameters: value String to encode
Returns: An encoded String
Returns: int
String values
are equal.
Parameters: value1 The left-hand side of the encoded String#equals(Object). value2 The right-hand side of the encoded String#equals(Object).
Returns: true if the encoded Strings are equal;
false otherwise.
See Also: DoubleMetaphone
String values
are equal, optionally using the alternate value.
Parameters: value1 The left-hand side of the encoded String#equals(Object). value2 The right-hand side of the encoded String#equals(Object). alternate use the alternate value if true.
Returns: true if the encoded Strings are equal;
false otherwise.
true if the value starts with any of 'GN', 'KN',
'PN', 'WR' or 'PS'.Parameters: maxCodeLen The maxCodeLen to set