59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
if (this.dSugg.get(0).length) {
// we sort the better results with the original word
let dDistTemp = new Map();
lRes.forEach((sSugg) => { dDistTemp.set(sSugg, str_transform.distanceDamerauLevenshtein(this.sWord, sSugg)); });
lRes = lRes.sort((sA, sB) => { return dDistTemp.get(sA) - dDistTemp.get(sB); });
dDistTemp.clear();
}
for (let lSugg of this.dSugg.values()) {
for (let sSugg of lSugg) { lRes.push(sSugg); }
if (lRes.length > nSuggLimit) {
break;
}
}
lRes = char_player.filterSugg(lRes);
if (this.sWord.gl_isUpperCase()) {
lRes = lRes.map((sSugg) => { return sSugg.toUpperCase(); });
|
|
>
>
>
|
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
if (this.dSugg.get(0).length) {
// we sort the better results with the original word
let dDistTemp = new Map();
lRes.forEach((sSugg) => { dDistTemp.set(sSugg, str_transform.distanceDamerauLevenshtein(this.sWord, sSugg)); });
lRes = lRes.sort((sA, sB) => { return dDistTemp.get(sA) - dDistTemp.get(sB); });
dDistTemp.clear();
}
for (let [nDist, lSugg] of this.dSugg.entries()) {
if (nDist > this.nDistLimit) {
break;
}
lRes.push(...lSugg);
if (lRes.length > nSuggLimit) {
break;
}
}
lRes = char_player.filterSugg(lRes);
if (this.sWord.gl_isUpperCase()) {
lRes = lRes.map((sSugg) => { return sSugg.toUpperCase(); });
|