113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
case "resetOptions":
resetOptions(dInfo);
break;
case "textToTest":
textToTest(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
break;
case "fullTests":
fullTests('{"nbsp":true, "esp":true, "unit":true, "num":true}', dInfo);
break;
case "getListOfTokens":
getListOfTokens(dParam.sText, dInfo);
break;
default:
console.log("Unknown command: " + sCommand);
showData(e.data);
|
|
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
case "resetOptions":
resetOptions(dInfo);
break;
case "textToTest":
textToTest(dParam.sText, dParam.sCountry, dParam.bDebug, dParam.bContext, dInfo);
break;
case "fullTests":
fullTests(dInfo);
break;
case "getListOfTokens":
getListOfTokens(dParam.sText, dInfo);
break;
default:
console.log("Unknown command: " + sCommand);
showData(e.data);
|
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
let sMsg = "";
for (let oErr of aGrammErr) {
sMsg += text.getReadableError(oErr) + "\n";
}
postMessage(createResponse("textToTest", sMsg, dInfo, true));
}
function fullTests (sGCOptions="", dInfo={}) {
if (!gc_engine || !oDict) {
postMessage(createResponse("fullTests", "# Grammar checker or dictionary not loaded.", dInfo, true));
return;
}
let dMemoOptions = gc_engine.getOptions();
if (sGCOptions) {
gc_engine.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
}
let sMsg = "";
for (let sRes of oTest.testParse()) {
sMsg += sRes + "\n";
console.log(sRes);
}
gc_engine.setOptions(dMemoOptions);
postMessage(createResponse("fullTests", sMsg, dInfo, true));
|
|
>
>
|
>
>
|
<
|
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
let sMsg = "";
for (let oErr of aGrammErr) {
sMsg += text.getReadableError(oErr) + "\n";
}
postMessage(createResponse("textToTest", sMsg, dInfo, true));
}
function fullTests (dInfo={}) {
if (!gc_engine || !oDict) {
postMessage(createResponse("fullTests", "# Grammar checker or dictionary not loaded.", dInfo, true));
return;
}
let dMemoOptions = gc_engine.getOptions();
let dTestOptions = gc_engine.getDefaultOptions();
dTestOptions.set("nbsp", true);
dTestOptions.set("esp", true);
dTestOptions.set("unit", true);
dTestOptions.set("num", true);
gc_engine.setOptions(dTestOptions);
let sMsg = "";
for (let sRes of oTest.testParse()) {
sMsg += sRes + "\n";
console.log(sRes);
}
gc_engine.setOptions(dMemoOptions);
postMessage(createResponse("fullTests", sMsg, dInfo, true));
|