1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// list of similar chars
// useful for suggestion mechanism
/* jshint esversion:6 */
/* jslint esversion:6 */
${map}
var char_player = {
oDistanceBetweenChars: {
"a": {},
"e": {"é": 0.5},
"é": {"e": 0.5},
"i": {"y": 0.2},
"o": {},
"u": {},
"y": {"i": 0.3},
"b": {"d": 0.8, "h": 0.9},
"c": {"ç": 0.1, "k": 0.5, "q": 0.5, "s": 0.5, "x": 0.5, "z": 0.8},
"d": {"b": 0.8},
"f": {"v": 0.8},
"g": {"j": 0.5},
"h": {"b": 0.9},
"j": {"g": 0.5, "i": 0.9},
"k": {"c": 0.5, "q": 0.1, "x": 0.5},
"l": {"i": 0.9},
"m": {"n": 0.8},
"n": {"m": 0.8, "r": 0.9},
"p": {"q": 0.9},
"q": {"c": 0.5, "k": 0.1, "p": 0.9},
"r": {"n": 0.9, "j": 0.9},
"s": {"c": 0.5, "ç": 0.1, "x": 0.5, "z": 0.5},
"t": {"d": 0.9},
"v": {"f": 0.8, "w": 0.1},
"w": {"v": 0.1},
"x": {"c": 0.5, "k": 0.5, "q": 0.5, "s": 0.5},
"z": {"s": 0.5}
},
distanceBetweenChars: function (c1, c2) {
if (c1 == c2) {
return 0;
}
if (this.oDistanceBetweenChars.hasOwnProperty(c1) && this.oDistanceBetweenChars[c1].hasOwnProperty(c2)) {
|
|
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// list of similar chars
// useful for suggestion mechanism
/* jshint esversion:6 */
/* jslint esversion:6 */
${map}
var char_player = {
/*
oDistanceBetweenChars:
- with Jaro-Winkler, values between 1 and 10
- with Damerau-Levenshtein, values / 10 (between 0 and 1: 0.1, 0.2 ... 0.9)
*/
oDistanceBetweenChars: {
//"a": {},
"e": {"é": 5},
//"é": {"e": 5},
"i": {"y": 2},
//"o": {},
//"u": {},
"y": {"i": 3},
"b": {"d": 8, "h": 9},
"c": {"ç": 1, "k": 5, "q": 5, "s": 5, "x": 5, "z": 8},
"d": {"b": 8},
"f": {"v": 8},
"g": {"j": 5},
"h": {"b": 9},
"j": {"g": 5, "i": 9},
"k": {"c": 5, "q": 1, "x": 5},
"l": {"i": 9},
"m": {"n": 8},
"n": {"m": 8, "r": 9},
"p": {"q": 9},
"q": {"c": 5, "k": 1, "p": 9},
"r": {"n": 9, "j": 9},
"s": {"c": 5, "ç": 1, "x": 5, "z": 5},
"t": {"d": 9},
"v": {"f": 8, "w": 1},
"w": {"v": 1},
"x": {"c": 5, "k": 5, "q": 5, "s": 5},
"z": {"s": 5}
},
distanceBetweenChars: function (c1, c2) {
if (c1 == c2) {
return 0;
}
if (this.oDistanceBetweenChars.hasOwnProperty(c1) && this.oDistanceBetweenChars[c1].hasOwnProperty(c2)) {
|