227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
-
+
-
-
+
-
-
-
+
+
-
-
-
-
+
-
+
|
function parseAndSpellcheck1 (sParagraph, sCountry, bDebug, bContext, oInfo={}) {
sParagraph = sParagraph.replace(//g, "").normalize("NFC");
let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext);
let aSpellErr = oSpellChecker.parseParagraph(sParagraph);
postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, oInfo, true));
}
function parseFull (sText, sCountry, bDebug, bContext, oInfo={}) {
function parseFull (sParagraph, sCountry, bDebug, bContext, oInfo={}) {
let i = 0;
sText = sText.replace(//g, "").normalize("NFC");
sParagraph = sParagraph.replace(//g, "").normalize("NFC");
for (let sParagraph of text.getParagraph(sText)) {
let lSentence = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext, true);
console.log("*", lSentence);
let [lParagraphErrors, lSentences] = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext, true);
//console.log(lSentences);
postMessage(createResponse("parseFull", {sParagraph: sParagraph, iParaNum: i, lSentence: lSentence}, oInfo, false));
i += 1;
}
postMessage(createResponse("parseFull", null, oInfo, true));
postMessage(createResponse("parseFull", { lParagraphErrors: lParagraphErrors, lSentences: lSentences }, oInfo, true));
}
function getListOfTokens (sText, oInfo={}) {
// lexicographer
try {
sText = sText.replace(//g, "").normalize("NFC");
for (let sParagraph of text.getParagraph(sText)) {
if (sParagraph.trim() !== "") {
postMessage(createResponse("getListOfTokens", lexgraph_fr.getListOfTokensReduc(sParagraph, true), oInfo, false));
postMessage(createResponse("getListOfTokens", { sParagraph: sParagraph, lTokens: lexgraph_fr.getListOfTokensReduc(sParagraph, true) }, oInfo, false));
}
}
postMessage(createResponse("getListOfTokens", null, oInfo, true));
}
catch (e) {
console.error(e);
postMessage(createResponse("getListOfTokens", createErrorResult(e, "no tokens"), oInfo, true, true));
|