Grammalecte  Check-in [8f2d9b2f72]

Overview
Comment:[tb] lexicon editor: update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | multid
Files: files | file ages | folders
SHA3-256: 8f2d9b2f72eaf223e05b62d5a372410dd2fcff2de6ad8a0e5cae2958eda3a556
User & Date: olr on 2018-03-17 11:02:11
Other Links: branch diff | manifest | tags
Context
2018-03-17
15:32
[tb] lexicon editor: update check-in: 550fb30fe3 user: olr tags: tb, multid
11:02
[tb] lexicon editor: update check-in: 8f2d9b2f72 user: olr tags: tb, multid
2018-03-16
19:35
[tb] lexicon editor (draft) check-in: 54c59ba375 user: olr tags: tb, multid
Changes

Modified gc_lang/fr/tb/content/lex_editor.js from [8ebc116be1] to [96f662f9f6].

16
17
18
19
20
21
22
23



24
25
26
27
28
29
30
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32







-
+
+
+







    Cu.reportError(e);
    console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
}

function createNode  (sType, oAttr) {
    try {
        let xNode = document.createElement(sType);
        Object.assign(xNode, oAttr);
        for (let sParam in oAttr) {
            xNode.setAttribute(sParam, oAttr[sParam]);
        }
        return xNode;
    }
    catch (e) {
        showError(e);
    }
}

66
67
68
69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83
84
85
86
87







-





+







        this._createHeader();
        this.listen();
    }

    _createHeader () {
        let xListheadNode = createNode("listhead");
        xListheadNode.appendChild(createNode("listheader", { label: "·", width: "12px" }));
        //xListheadNode.appendChild(createNode("listheader", { label: "#" }));
        for (let sColumn of this.lColumn) {
            xListheadNode.appendChild(createNode("listheader", { label: sColumn }));
        }
        this.xTable.appendChild(xListheadNode);
        let xListcolsNode = createNode("listcols");
        xListcolsNode.appendChild(createNode("listcol", { flex: 1 }));
        for (let cColumn of this.lColumnWidth) {
            xListcolsNode.appendChild(createNode("listcol", { flex: cColumn }));
        }
        this.xTable.appendChild(xListcolsNode);
    }

    clear () {
263
264
265
266
267
268
269
270

271
272
273
274
275
276
277
265
266
267
268
269
270
271

272
273
274
275
276
277
278
279







-
+








    lTag: ["N", "M", "V", "W", "X"],

    setMainTag: function (cTag) {
        this.cMainTag = cTag;
        for (let c of this.lTag) {
            if (c !== cTag) {
                document.getElementById("tag_"+cTag).checked = false;
                document.getElementById("tag_"+c).checked = false;
            }
        }
    },

    update: function (cTag=null) {
        if (cTag !== null) {
            this.setMainTag(cTag);
319
320
321
322
323
324
325
326
327
328
329
330
331
332







333
334
335

336
337
338

339
340
341
342
343
344
345
321
322
323
324
325
326
327







328
329
330
331
332
333
334
335
336

337
338
339

340
341
342
343
344
345
346
347







-
-
-
-
-
-
-
+
+
+
+
+
+
+


-
+


-
+







                        break;
                    case "V": {
                        if (!this.sLemma.endsWith("er") && !this.sLemma.endsWith("ir") && !this.sLemma.endsWith("re")) {
                            break;
                        }
                        this.sLemma = this.sLemma.toLowerCase();
                        let cGroup = "";
                        let c_i = (document.getElementById("up_v_i").checked) ? "i" : "_";
                        let c_t = (document.getElementById("up_v_t").checked) ? "t" : "_";
                        let c_n = (document.getElementById("up_v_n").checked) ? "n" : "_";
                        let c_p = (document.getElementById("up_v_p").checked) ? "p" : "_";
                        let c_m = (document.getElementById("up_v_m").checked) ? "m" : "_";
                        let c_ae = (document.getElementById("up_v_ae").checked) ? "e" : "_";
                        let c_aa = (document.getElementById("up_v_aa").checked) ? "a" : "_";
                        let c_i = (document.getElementById("v_i").checked) ? "i" : "_";
                        let c_t = (document.getElementById("v_t").checked) ? "t" : "_";
                        let c_n = (document.getElementById("v_n").checked) ? "n" : "_";
                        let c_p = (document.getElementById("v_p").checked) ? "p" : "_";
                        let c_m = (document.getElementById("v_m").checked) ? "m" : "_";
                        let c_ae = (document.getElementById("v_ae").checked) ? "e" : "_";
                        let c_aa = (document.getElementById("v_aa").checked) ? "a" : "_";
                        let sVerbTag = c_i + c_t + c_n + c_p + c_m + c_ae + c_aa;
                        if (!sVerbTag.endsWith("__") && !sVerbTag.startsWith("____")) {
                            let sVerbPattern = document.getElementById("verb_pattern").value.trim();
                            let sVerbPattern = document.getElementById("verbe_modele").value.trim();
                            if (sVerbPattern.length == 0) {
                                // utilisation du générateur de conjugaison
                                let bVarPpas = document.getElementById("up_partpas").checked;
                                let bVarPpas = document.getElementById("v_ppas").checked;
                                for (let [sFlexion, sFlexTags] of conj_generator.conjugate(this.sLemma, sVerbTag, bVarPpas)) {
                                    this.lFlexion.push([sFlexion, sFlexTags]);
                                }
                            } else {
                                // copie du motif d’un autre verbe : utilisation du conjugueur
                                if (conj.isVerb(sVerbPattern)) {
                                    let oVerb = new Verb(this.sLemma, sVerbPattern);
373
374
375
376
377
378
379
380

381
382
383
384
385
386
387
375
376
377
378
379
380
381

382
383
384
385
386
387
388
389







-
+







                    }
                    case "W":
                        this.sLemma = this.sLemma.toLowerCase();
                        this.lFlexion.push([this.sLemma, ":W/*"]);
                        break;
                    case "M":
                        this.sLemma = this.sLemma.slice(0,1).toUpperCase() + this.sLemma.slice(1);
                        let sPOSTag = this.getRadioValue("pos_nom_propre")
                        let sPOSTag = this.getRadioValue("pos_nom_propre");
                        let sGenderTag = this.getRadioValue("genre_nom_propre");
                        if (sGenderTag) {
                            this.lFlexion.push([this.sLemma, sPOSTag+sGenderTag+":i/*"]);
                        }
                        break;
                    case "X":
                        let sFlexion = document.getElementById("flexion").value.trim();
486
487
488
489
490
491
492
493
494


495
496
497
498
488
489
490
491
492
493
494


495
496
497
498
499
500







-
-
+
+




        let xBlob = new Blob([ JSON.stringify(this.oIBDAWG.getJSON()) ], {type: 'application/json'}); 
        let sURL = URL.createObjectURL(xBlob);
        browser.downloads.download({ filename: "fr.personal.json", url: sURL, saveAs: true });
    }
}


const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], [4, 3, 4],"progress_lexicon", "num_entries");
const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], [1, 1], "progress_new_words");
const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], [10, 7, 10],"progress_lexicon", "num_entries");
const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], [10, 10], "progress_new_words");

oBinaryDict.load();
oBinaryDict.listen();
oGenerator.listen();

Modified gc_lang/fr/tb/content/lex_editor.xul from [e881f6b2fc] to [f370f1df19].

54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68







-
+







                <radio id="N_epi" class="option" label="épicène" value=":e" />
                <radio id="N_mas" class="option" label="masculin" value=":m" />
                <radio id="N_fem" class="option" label="féminin" value=":f" />
              </radiogroup>
              <radiogroup id="pluriel_nom_commun" orient="vertical">
                <radio id="N_s" class="option" label="pluriel en ·s" value="s" />
                <radio id="N_x" class="option" label="pluriel en ·x" value="x" />
                <radio id="N_inv" class="option" label="invariable" value="inv" />
                <radio id="N_inv" class="option" label="invariable" value="i" />
              </radiogroup>
            </hbox>
            <vbox class="m_left2">
              <label class="subsection" value="[optionnel] Autre forme (masculine, féminine, variante…)" />
              <textbox id="lemma2" value="" />
              <hbox>
                <radiogroup id="pos_nom_commun2" orient="vertical">