Grammalecte  Check-in [a709782a5c]

Overview
Comment:[fx] lexicographer: messages
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256: a709782a5c5a9bf0287a8754338cdf60166ed3a070d2611b1c8e15ec2057df11
User & Date: olr on 2020-10-17 23:22:10
Other Links: manifest | tags
Context
2020-10-19
11:27
[fr] ajustements check-in: de1a9aeaf3 user: olr tags: trunk, fr
2020-10-17
23:22
[fx] lexicographer: messages check-in: a709782a5c user: olr tags: trunk, fx
23:21
[fr] ajustements check-in: 9c4e4db18b user: olr tags: trunk, fr
Changes

Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [00f590124b] to [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;