117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
break;
case "textToTest":
textToTest(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
break;
case "fullTests":
fullTests(dInfo);
break;
case "getSpellSuggestions":
getSpellSuggestions(dParam.sWord, dInfo);
break;
case "getListOfTokens":
getListOfTokens(dParam.sText, dInfo);
break;
default:
|
>
>
>
|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
break;
case "textToTest":
textToTest(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
break;
case "fullTests":
fullTests(dInfo);
break;
case "setDictionary":
setDictionary(dParam.sType, dParam.oDict, dInfo);
break;
case "getSpellSuggestions":
getSpellSuggestions(dParam.sWord, dInfo);
break;
case "getListOfTokens":
getListOfTokens(dParam.sText, dInfo);
break;
default:
|
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
console.log(sRes);
}
gc_engine.setOptions(dMemoOptions);
postMessage(createResponse("fullTests", sMsg, dInfo, true));
}
// Spellchecker
function getSpellSuggestions (sWord, dInfo) {
if (!oSpellChecker) {
postMessage(createResponse("getSpellSuggestions", "# Error. Dictionary not loaded.", dInfo, true));
return;
}
let i = 1;
for (let aSugg of oSpellChecker.suggest(sWord)) {
postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSugg: i}, dInfo, true));
i += 1;
}
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
console.log(sRes);
}
gc_engine.setOptions(dMemoOptions);
postMessage(createResponse("fullTests", sMsg, dInfo, true));
}
// SpellChecker
function setDictionary (sType, oDict, dInfo) {
if (!oSpellChecker) {
postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", dInfo, true));
return;
}
switch (sType) {
case "main":
oSpellChecker.setMainDictionary(oDict);
postMessage(createResponse("setDictionary", true, dInfo, true));
break;
case "extended":
oSpellChecker.setExtendedDictionary(oDict);
postMessage(createResponse("setDictionary", true, dInfo, true));
break;
case "personal":
oSpellChecker.setPersonalDictionary(oDict);
postMessage(createResponse("setDictionary", true, dInfo, true));
break;
default:
console.log("[worker] setDictionary: Unknown command");
}
}
function getSpellSuggestions (sWord, dInfo) {
if (!oSpellChecker) {
postMessage(createResponse("getSpellSuggestions", "# Error. SpellChecker not loaded.", dInfo, true));
return;
}
let i = 1;
for (let aSugg of oSpellChecker.suggest(sWord)) {
postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSugg: i}, dInfo, true));
i += 1;
}
|