|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.tumba.spell.Phonetic
public class Phonetic
Implementation of Phonetic similarity algorithms (Soundex, Metaphone and Double Metaphone), used to reduce matching problems from wrong spellings.
A Soundex search algorithm takes a word, such as a person's name, as input and produces a character string which identifies a set of words that are (roughly) phonetically alike. It is very handy for searching large databases when the user has incomplete data.
The original Soundex algorithm was patented by Margaret O'Dell and Robert C. Russell in 1918. The method is based on the six phonetic classifications of human speech sounds (bilabial, labiodental, dental, alveolar, velar, and glottal), which in turn are based on where you put your lips and tongue to make the sounds.
As for the metaphone algorithm, it encodes English words phonetically, by reducing them to 16 consonant sounds. It originally appeared in the December 1990 issue of Computer Language by Lawrence Philips. Vowels are minimized as much as possible, and consenants that have similiar sounds are converted to the same consenant for example, 'v' and 'f' are both converted to 'f'.
The double metaphone algorithm is a better variant, coding English words (and foreign words often heard in the United States) phonetically by reducing them to 12 consonant sounds. It was also proposed by Lawrence Philips, in an C/C++ Users Journal(tm) article entitled The Double Metaphone Search Algorithm.
Field Summary | |
---|---|
private static java.lang.String[] |
list1
|
private static java.lang.String[] |
list10
|
private static java.lang.String[] |
list11
|
private static java.lang.String[] |
list12
|
private static java.lang.String[] |
list13
|
private static java.lang.String[] |
list14
|
private static java.lang.String[] |
list15
|
private static java.lang.String[] |
list16
|
private static java.lang.String[] |
list17
|
private static java.lang.String[] |
list18
|
private static java.lang.String[] |
list19
|
private static java.lang.String[] |
list2
|
private static java.lang.String[] |
list20
|
private static java.lang.String[] |
list21
|
private static java.lang.String[] |
list22
|
private static java.lang.String[] |
list23
|
private static java.lang.String[] |
list24
|
private static java.lang.String[] |
list25
|
private static java.lang.String[] |
list27
|
private static java.lang.String[] |
list28
|
private static java.lang.String[] |
list29
|
private static java.lang.String[] |
list3
|
private static java.lang.String[] |
list30
|
private static java.lang.String[] |
list31
|
private static java.lang.String[] |
list32
|
private static java.lang.String[] |
list33
|
private static java.lang.String[] |
list34
|
private static java.lang.String[] |
list35
|
private static java.lang.String[] |
list36
|
private static java.lang.String[] |
list37
|
private static java.lang.String[] |
list38
|
private static java.lang.String[] |
list39
|
private static java.lang.String[] |
list4
|
private static java.lang.String[] |
list40
|
private static java.lang.String[] |
list41
|
private static java.lang.String[] |
list42
|
private static java.lang.String[] |
list43
|
private static java.lang.String[] |
list44
|
private static java.lang.String[] |
list45
|
private static java.lang.String[] |
list46
|
private static java.lang.String[] |
list47
|
private static java.lang.String[] |
list48
|
private static java.lang.String[] |
list5
|
private static java.lang.String[] |
list50
|
private static java.lang.String[] |
list51
|
private static java.lang.String[] |
list52
|
private static java.lang.String[] |
list53
|
private static java.lang.String[] |
list54
|
private static java.lang.String[] |
list55
|
private static java.lang.String[] |
list56
|
private static java.lang.String[] |
list57
|
private static java.lang.String[] |
list58
|
private static java.lang.String[] |
list59
|
private static java.lang.String[] |
list6
|
private static java.lang.String[] |
list60
|
private static java.lang.String[] |
list61
|
private static java.lang.String[] |
list62
|
private static java.lang.String[] |
list63
|
private static java.lang.String[] |
list64
|
private static java.lang.String[] |
list65
|
private static java.lang.String[] |
list66
|
private static java.lang.String[] |
list67
|
private static java.lang.String[] |
list68
|
private static java.lang.String[] |
list69
|
private static java.lang.String[] |
list7
|
private static java.lang.String[] |
list70
|
private static java.lang.String[] |
list71
|
private static java.lang.String[] |
list72
|
private static java.lang.String[] |
list73
|
private static java.lang.String[] |
list74
|
private static java.lang.String[] |
list75
|
private static java.lang.String[] |
list76
|
private static java.lang.String[] |
list77
|
private static java.lang.String[] |
list78
|
private static java.lang.String[] |
list79
|
private static java.lang.String[] |
list8
|
private static java.lang.String[] |
list80
|
private static java.lang.String[] |
list81
|
private static java.lang.String[] |
list82
|
private static java.lang.String[] |
list83
|
private static java.lang.String[] |
list84
|
private static java.lang.String[] |
list85
|
private static java.lang.String[] |
list86
|
private static java.lang.String[] |
list87
|
private static java.lang.String[] |
list88
|
private static java.lang.String[] |
list89
|
private static java.lang.String[] |
list9
|
private static java.lang.String[] |
list90
|
private static java.lang.String[] |
list91
|
private static java.lang.String[] |
list92
|
private static java.lang.String[] |
list93
|
private static java.lang.String[] |
list94
|
private static java.lang.String[] |
list95
|
private static java.lang.String[] |
myList
|
private static char[] |
replaceList
|
private static java.lang.String[] |
soundexCodes
The transformation codes used for the soundex algorithm. |
private static Phonetic |
theInstance
The single instance of this class. |
Constructor Summary | |
---|---|
private |
Phonetic()
Sole constructor, private because this is a Singleton class. |
Method Summary | |
---|---|
static java.lang.String |
getDoubleMetaphone(java.lang.String word)
Calculates the Double Metaphone value of a given String . |
static Phonetic |
getInstance()
Return the single instance of this class. |
static java.lang.String |
getMetaphone(java.lang.String word)
Calculate the Metaphone value of a given String . |
private static char |
getNum(char c)
Gets the index for the attribute of the Soundex transformation codes corresponding to a given char. |
static java.lang.String |
getSoundex(java.lang.String word)
Calculate the Soundex value of a given String . |
static boolean |
SlavoGermanic(java.lang.String in)
Checks if a given word is slavo-germanic. |
private static boolean |
stringAt(java.lang.String string,
int start,
int length,
java.lang.String[] list)
Checks if part of a given String is equal to any of the String objects supplied in a List . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Phonetic theInstance
private static final java.lang.String[] soundexCodes
private static char[] replaceList
private static final java.lang.String[] myList
private static final java.lang.String[] list1
private static final java.lang.String[] list2
private static final java.lang.String[] list3
private static final java.lang.String[] list4
private static final java.lang.String[] list5
private static final java.lang.String[] list6
private static final java.lang.String[] list7
private static final java.lang.String[] list8
private static final java.lang.String[] list9
private static final java.lang.String[] list10
private static final java.lang.String[] list11
private static final java.lang.String[] list12
private static final java.lang.String[] list13
private static final java.lang.String[] list14
private static final java.lang.String[] list15
private static final java.lang.String[] list16
private static final java.lang.String[] list17
private static final java.lang.String[] list18
private static final java.lang.String[] list19
private static final java.lang.String[] list20
private static final java.lang.String[] list21
private static final java.lang.String[] list22
private static final java.lang.String[] list23
private static final java.lang.String[] list24
private static final java.lang.String[] list25
private static final java.lang.String[] list27
private static final java.lang.String[] list28
private static final java.lang.String[] list29
private static final java.lang.String[] list30
private static final java.lang.String[] list31
private static final java.lang.String[] list32
private static final java.lang.String[] list33
private static final java.lang.String[] list34
private static final java.lang.String[] list35
private static final java.lang.String[] list36
private static final java.lang.String[] list37
private static final java.lang.String[] list38
private static final java.lang.String[] list39
private static final java.lang.String[] list40
private static final java.lang.String[] list41
private static final java.lang.String[] list42
private static final java.lang.String[] list43
private static final java.lang.String[] list44
private static final java.lang.String[] list45
private static final java.lang.String[] list46
private static final java.lang.String[] list47
private static final java.lang.String[] list48
private static final java.lang.String[] list50
private static final java.lang.String[] list51
private static final java.lang.String[] list52
private static final java.lang.String[] list53
private static final java.lang.String[] list54
private static final java.lang.String[] list55
private static final java.lang.String[] list56
private static final java.lang.String[] list57
private static final java.lang.String[] list58
private static final java.lang.String[] list59
private static final java.lang.String[] list60
private static final java.lang.String[] list61
private static final java.lang.String[] list62
private static final java.lang.String[] list63
private static final java.lang.String[] list64
private static final java.lang.String[] list65
private static final java.lang.String[] list66
private static final java.lang.String[] list67
private static final java.lang.String[] list68
private static final java.lang.String[] list69
private static final java.lang.String[] list70
private static final java.lang.String[] list71
private static final java.lang.String[] list72
private static final java.lang.String[] list73
private static final java.lang.String[] list74
private static final java.lang.String[] list75
private static final java.lang.String[] list76
private static final java.lang.String[] list77
private static final java.lang.String[] list78
private static final java.lang.String[] list79
private static final java.lang.String[] list80
private static final java.lang.String[] list81
private static final java.lang.String[] list82
private static final java.lang.String[] list83
private static final java.lang.String[] list84
private static final java.lang.String[] list85
private static final java.lang.String[] list86
private static final java.lang.String[] list87
private static final java.lang.String[] list88
private static final java.lang.String[] list89
private static final java.lang.String[] list90
private static final java.lang.String[] list91
private static final java.lang.String[] list92
private static final java.lang.String[] list93
private static final java.lang.String[] list94
private static final java.lang.String[] list95
Constructor Detail |
---|
private Phonetic()
Method Detail |
---|
public static Phonetic getInstance()
Phonetic
.public static java.lang.String getMetaphone(java.lang.String word)
String
. This method transforms
the parameter into a String
according to the Metaphone algorithm.
word
- The String
to transform.
String
.private static char getNum(char c)
c
- A character.
public static java.lang.String getSoundex(java.lang.String word)
String
. This method transforms
the parameter into a String
according to the Soundex algorithm.
word
- The String
to transform.
String
.public static final boolean SlavoGermanic(java.lang.String in)
in
- A String
with the word.
String
corresponds to a slavo-germanic word and false otherwise.private static boolean stringAt(java.lang.String string, int start, int length, java.lang.String[] list)
String
is equal to any of the String
objects supplied in a List
.
string
- The input String
.start
- Starting position of the input String
to check.length
- Lengh of the String
to check, starting at the given starting position.list
- The List
of String
objects to check.
String
is equal to any of the strings supplied in a list and false otherwise.public static java.lang.String getDoubleMetaphone(java.lang.String word)
String
. This method transforms
the parameter into a String
according to the Double Metaphone algorithm.
word
- The String
to transform.
String
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |