188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
+
-
+
+
|
}
// Set to Array
aSugg = Array.from(aSugg);
aSugg = aSugg.filter((sSugg) => { return !sSugg.endsWith("è") && !sSugg.endsWith("È"); }); // fr language
if (sWord.gl_isTitle()) {
aSugg = aSugg.map((sSugg) => { return sSugg.gl_toCapitalize(); });
}
return aSugg.sort((sA, sB) => {
return aSugg.sort((sSugg) => { return char_player.distanceDamerauLevenshtein(sWord, sSugg); }).slice(0, nMaxSugg);
return char_player.distanceDamerauLevenshtein(sWord, sA) - char_player.distanceDamerauLevenshtein(sWord, sB);
}).slice(0, nMaxSugg);
}
_suggest (sRemain, nMaxDel=0, nDeep=0, iAddr=0, sNewWord="", bAvoidLoop=false) {
// returns a set of suggestions
// recursive function
//show(nDeep, sNewWord + ":" + sRemain)
let aSugg = new Set();
|