Grammalecte  Diff

Differences From Artifact [c528c957f0]:

To Artifact [09631747a1]:


418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433

    load: async function () {
        let sJSON = await oFileHandler.loadFile("fr.personal.json");
        if (sJSON != "") {
            let oJSON = JSON.parse(sJSON);
            this.oIBDAWG = new IBDAWG(oJSON);
            let lEntry = [];
            for (let s of this.oIBDAWG.select()) {
                lEntry.push(s.split("\t"));
            }        
            oLexiconTable.fill(lEntry);
            this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate);
            enableElement("export_button");
        } else {
            this.setDictData(0, "[néant]");
            disableElement("export_button");







|
|







418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433

    load: async function () {
        let sJSON = await oFileHandler.loadFile("fr.personal.json");
        if (sJSON != "") {
            let oJSON = JSON.parse(sJSON);
            this.oIBDAWG = new IBDAWG(oJSON);
            let lEntry = [];
            for (let aRes of this.oIBDAWG.select()) {
                lEntry.push(aRes);
            }        
            oLexiconTable.fill(lEntry);
            this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate);
            enableElement("export_button");
        } else {
            this.setDictData(0, "[néant]");
            disableElement("export_button");
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
        document.getElementById("search_regex_button").addEventListener("click", () => { this.searchRegex() }, false);
    },

    searchSimilar: function () {
        oSearchTable.clear();
        let sWord = document.getElementById("search_similar").value;
        if (sWord !== "") {
            let lSimilarWords = [];
            for (let l of this.oSpellChecker.suggest(sWord, 20)) {
                lSimilarWords.push(...l);
            }
            let lResult = [];
            for (let sSimilar of lSimilarWords) {
                for (let sMorph of this.oSpellChecker.getMorph(sSimilar)) {
                    let nCut = sMorph.indexOf(" ");
                    lResult.push( [sSimilar, sMorph.slice(1, nCut), sMorph.slice(nCut+1)] );
                }
            }
            oSearchTable.fill(lResult);
        }
    },

    searchRegex: function () {
        let sFlexPattern = document.getElementById("search_flexion_pattern").value.trim();
        let sTagsPattern = document.getElementById("search_tags_pattern").value.trim();
        let lEntry = [];
        let i = 0;
        for (let s of this.oSpellChecker.select(sFlexPattern, sTagsPattern)) {
            lEntry.push(s.split("\t"));
            i++;
            if (i >= 2000) {
                break;
            }
        }
        oSearchTable.fill(lEntry);
    }







<
<
<
<
|
<
<
<
<
<
<









|
|







488
489
490
491
492
493
494




495






496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
        document.getElementById("search_regex_button").addEventListener("click", () => { this.searchRegex() }, false);
    },

    searchSimilar: function () {
        oSearchTable.clear();
        let sWord = document.getElementById("search_similar").value;
        if (sWord !== "") {




            let lResult = this.oSpellChecker.getSimilarEntries(sWord, 20);






            oSearchTable.fill(lResult);
        }
    },

    searchRegex: function () {
        let sFlexPattern = document.getElementById("search_flexion_pattern").value.trim();
        let sTagsPattern = document.getElementById("search_tags_pattern").value.trim();
        let lEntry = [];
        let i = 0;
        for (let aRes of this.oSpellChecker.select(sFlexPattern, sTagsPattern)) {
            lEntry.push(aRes);
            i++;
            if (i >= 2000) {
                break;
            }
        }
        oSearchTable.fill(lEntry);
    }