Grammalecte  Diff

Differences From Artifact [08f4a4604e]:

To Artifact [107e6c6733]:


127
128
129
130
131
132
133



134
135
136
137
138
139
140
            break;
        case "setDictionaryOnOff":
            setDictionaryOnOff(dParam.sDictionary, dParam.bActivate, dInfo);
            break;
        case "getSpellSuggestions":
            getSpellSuggestions(dParam.sWord, dInfo);
            break;



        case "getListOfTokens":
            getListOfTokens(dParam.sText, dInfo);
            break;
        default:
            console.log("[Worker] Unknown command: " + sCommand);
            showData(e.data);
    }







>
>
>







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
            break;
        case "setDictionaryOnOff":
            setDictionaryOnOff(dParam.sDictionary, dParam.bActivate, dInfo);
            break;
        case "getSpellSuggestions":
            getSpellSuggestions(dParam.sWord, dInfo);
            break;
        case "getVerb":
            getVerb(dParam.sVerb, dParam.bPro, dParam.bNeg, dParam.bTpsCo, dParam.bInt, dParam.bFem, dInfo);
            break;
        case "getListOfTokens":
            getListOfTokens(dParam.sText, dInfo);
            break;
        default:
            console.log("[Worker] Unknown command: " + sCommand);
            showData(e.data);
    }
367
368
369
370
371
372
373



















374
375
376
377
378
379
380
    let i = 0;
    for (let aSugg of oSpellChecker.suggest(sWord)) {
        postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, dInfo, true));
        i += 1;
    }
}





















// Lexicographer

function getListOfTokens (sText, dInfo={}) {
    try {
        sText = sText.replace(/­/g, "").normalize("NFC");
        for (let sParagraph of text.getParagraph(sText)) {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
    let i = 0;
    for (let aSugg of oSpellChecker.suggest(sWord)) {
        postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, dInfo, true));
        i += 1;
    }
}


// Conjugueur

function getVerb (sWord, bPro, bNeg, bTpsCo, bInt, bFem, dInfo) {
    try {
        let oVerb = null;
        let oConjTable = null;
        if (conj.isVerb(sWord)) {
            oVerb = new Verb(sWord);
            oConjTable = oVerb.createConjTable(bPro, bNeg, bTpsCo, bInt, bFem);
        }
        postMessage(createResponse("getVerb", { oVerb: oVerb, oConjTable: oConjTable }, dInfo, true));
    }
    catch (e) {
        console.error(e);
        postMessage(createResponse("getVerb", createErrorResult(e, "no verb"), dInfo, true, true));
    }
}


// Lexicographer

function getListOfTokens (sText, dInfo={}) {
    try {
        sText = sText.replace(/­/g, "").normalize("NFC");
        for (let sParagraph of text.getParagraph(sText)) {