Grammalecte  Diff

Differences From Artifact [00f590124b]:

To Artifact [9de466bad8]:


12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
12
13
14
15
16
17
18

19
20
21
22
23
24
25
26







-
+







        let xElem = xEvent.target;
        if (xElem.id) {
            if (xElem.id.startsWith("grammalecte_sugg")) {
                oGrammalecte.oGCPanel.applySuggestion(xElem.id);
            } else if (xElem.id === "grammalecte_tooltip_ignore") {
                oGrammalecte.oGCPanel.ignoreError(xElem.id);
            } else if (xElem.id.startsWith("grammalecte_analysis")) {
                oGrammalecte.oGCPanel.sendParagraphToGrammaticalAnalysis(parseInt(xElem.dataset.para_num, 10));
                oGrammalecte.oGCPanel.sendParagraphToLexicographer(parseInt(xElem.dataset.para_num, 10));
            } else if (xElem.id.startsWith("grammalecte_check")) {
                oGrammalecte.oGCPanel.recheckParagraph(parseInt(xElem.dataset.para_num, 10));
            } else if (xElem.id.startsWith("grammalecte_hide")) {
                xElem.parentNode.parentNode.style.display = "none";
            } else if (xElem.id.startsWith("grammalecte_err")
                       && xElem.className !== "grammalecte_error_corrected"
                       && xElem.className !== "grammalecte_error_ignored") {
544
545
546
547
548
549
550






551
552
553
554

555
556
557
558
559
560
561
562
563
564
565
566
567
568


569
570
571
572
573
574
575
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559

560
561
562
563
564
565
566
567
568
569
570
571
572
573

574
575
576
577
578
579
580
581
582







+
+
+
+
+
+



-
+













-
+
+








    clearLexicographer () {
        this.nLxgCount = 0;
        while (this.xLxgResultZone.firstChild) {
            this.xLxgResultZone.removeChild(this.xLxgResultZone.firstChild);
        }
    }

    addMessageToLexicographer (sMessage) {
        let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_flow_message", textContent: sMessage});
        this.xLxgResultZone.appendChild(xNode);
    }


    //  Grammatical analysis

    sendParagraphToGrammaticalAnalysis (iParaNum) {
    sendParagraphToLexicographer (iParaNum) {
        let xParagraph = this.xParent.getElementById("grammalecte_paragraph" + iParaNum);
        this.xLxgInput.textContent = xParagraph.textContent;
        this.grammaticalAnalysis();
        this.showLexicographer();
    }

    grammaticalAnalysis (iParaNum) {
        if (!this.bOpened || this.bWorking) {
            return;
        }
        this.startWaitIcon();
        this.clearLexicographer();
        let sText = this.xLxgInput.innerText.replace(/\n/g, " ");
        console.log(sText);
        //console.log(sText);
        this.addMessageToLexicographer("Analyse grammaticale : les mots sont analysés autant que possible en fonction du contexte (cette fonctionnalité est expérimentale).");
        oGrammalecteBackgroundPort.parseFull(sText, "__GrammalectePanel__");
    }

    showParagraphAnalysis (oResult) {
        if (!this.bOpened || oResult === null) {
            return;
        }
606
607
608
609
610
611
612
613


614
615
616
617
618
619
620
613
614
615
616
617
618
619

620
621
622
623
624
625
626
627
628







-
+
+







    getListOfTokens () {
        if (!this.bOpened || this.bWorking) {
            return;
        }
        this.startWaitIcon();
        this.clearLexicographer();
        let sText = this.xLxgInput.innerText; // to get carriage return (\n)
        console.log(sText);
        //console.log(sText);
        this.addMessageToLexicographer("Analyse lexicale : chaque mot est analysé indépendamment du contexte.");
        oGrammalecteBackgroundPort.getListOfTokens(sText, "__GrammalectePanel__");
    }

    addListOfTokens (oResult) {
        try {
            if (oResult && oResult.sParagraph != "") {
                this.nLxgCount += 1;