public class DoubleMetaphoneTransformator extends java.lang.Object implements Transformator
Source code for the original C++ can be found here: http://aspell.sourceforge.net/metaphone/ DoubleMetaphone does some processing, such as uppercasing, on the input string first to normalize it. Then, to create the key, the function traverses the input string in a while loop, sending successive characters into a giant switch statement. Before determining the appropriate pronunciation, the algorithm considers the context surrounding each character within the input string.
| Constructor and Description |
|---|
DoubleMetaphoneTransformator() |
| Modifier and Type | Method and Description |
|---|---|
char[] |
getReplaceList()
gets the list of characters that should be swapped in to the misspelled
word in order to try to find more suggestions.
|
java.lang.String |
transform(java.lang.String word)
Take the given word, and return the best phonetic hash for it.
|
public final java.lang.String transform(java.lang.String word)
transform in interface Transformatorword - the text to transformpublic char[] getReplaceList()
TransformatorThe replace list is used in the getSuggestions method. All of the letters in the misspelled word are replaced with the characters from this list to try and generate more suggestions, which implies l*n tries, if l is the size of the string, and n is the size of this list.
In addition to that, each of these letters is added to the misspelled word.
getReplaceList in interface TransformatorTransformator.getReplaceList()