Grammalecte  Check-in [54c59ba375]

Overview
Comment:[tb] lexicon editor (draft)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | multid
Files: files | file ages | folders
SHA3-256: 54c59ba375ac105862e18236474d2801c6997e12e6aff87ddbabac1152dcba1c
User & Date: olr on 2018-03-16 19:35:14
Other Links: branch diff | manifest | tags
Context
2018-03-17
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
2018-03-12
12:12
[tb] lexicon editor: ui update check-in: 600f33b256 user: olr tags: tb, multid
Changes

Modified gc_lang/fr/tb/content/lex_editor.css from [3daf66ca1c] to [acf1557d56].

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.other_label {
    width: 80px;
}
.other_textbox {
    width: 250px;
}

#generated_words {
    width: 400px;
    height: 620px;
}


/*
    Lexicon tab
*/

#lexicon {
    width: 600px;
    height: 650px;
}

.info_label {
    width: 120px;
}







|

|







|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.other_label {
    width: 80px;
}
.other_textbox {
    width: 250px;
}

#generated_words_table {
    width: 400px;
    height: 600px;
}


/*
    Lexicon tab
*/

#lexicon_table {
    width: 600px;
    height: 650px;
}

.info_label {
    width: 120px;
}

Modified gc_lang/fr/tb/content/lex_editor.js from [0a699fc4f2] to [8ebc116be1].

1
2
3
4














































































































































































































































































































































































































































































































// JavaScript

"use strict";



















































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
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
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
// JavaScript

"use strict";

const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.grammarchecker.");


/*
    Common functions
*/

function showError (e) {
    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);
        return xNode;
    }
    catch (e) {
        showError(e);
    }
}

function enableElement (sElemId) {
    if (document.getElementById(sElemId)) {
        document.getElementById(sElemId).disabled = false;
    } else {
        console.log("HTML node named <" + sElemId + "> not found.")
    }
}

function disableElement (sElemId) {
    if (document.getElementById(sElemId)) {
        document.getElementById(sElemId).disabled = true;
    } else {
        console.log("HTML node named <" + sElemId + "> not found.")
    }
}



document.getElementById("save_button").addEventListener("click", () => { oBinaryDict.build(); }, false);



class Table {

    constructor (sNodeId, lColumn, lColumnWidth, sProgressBarId, sResultId="") {
        this.sNodeId = sNodeId;
        this.xTable = document.getElementById(sNodeId);
        this.nColumn = lColumn.length;
        this.lColumn = lColumn;
        this.lColumnWidth = lColumnWidth;
        this.xProgressBar = document.getElementById(sProgressBarId);
        this.xNumEntry = document.getElementById(sResultId);
        this.iEntryIndex = 0;
        this.lEntry = [];
        this.nEntry = 0
        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");
        for (let cColumn of this.lColumnWidth) {
            xListcolsNode.appendChild(createNode("listcol", { flex: cColumn }));
        }
        this.xTable.appendChild(xListcolsNode);
    }

    clear () {
        while (this.xTable.firstChild) {
            this.xTable.removeChild(this.xTable.firstChild);
        }
        this.iEntryIndex = 0;
        this._createHeader();
    }

    fill (lFlex) {
        this.clear();
        if (lFlex.length > 0) {
            this.xProgressBar.max = lFlex.length;
            this.xProgressBar.value = 1;
            for (let lData of lFlex) {
                this._addRow(lData);
                this.xProgressBar.value += 1;
            }
            this.xProgressBar.value = this.xProgressBar.max;
        }
        this.lEntry = lFlex;
        this.nEntry = lFlex.length;
        this.showEntryNumber();
    }

    addEntries (lFlex) {
        this.lEntry.push(...lFlex);
        for (let lData of lFlex) {
            this._addRow(lData);
        }
        this.nEntry += lFlex.length;
        this.showEntryNumber();
    }

    showEntryNumber () {
        if (this.xNumEntry) {
            this.xNumEntry.textContent = this.nEntry;
        }
    }

    _addRow (lData) {
        let xRowNode = createNode("listitem", { id: this.sNodeId + "_row_" + this.iEntryIndex });
        xRowNode.appendChild(createNode("listcell", { label: "×", className: "delete_entry", title: "Effacer cette entrée", value: this.iEntryIndex }));
        //xRowNode.appendChild(createNode("listcell", { label: this.iEntryIndex }));
        for (let data of lData) {
            xRowNode.appendChild(createNode("listcell", { label: data }));
        }
        this.xTable.appendChild(xRowNode);
        this.iEntryIndex += 1;
    }

    listen () {
        this.xTable.addEventListener("click", (xEvent) => { this.onTableClick(xEvent); }, false);
    }

    onTableClick (xEvent) {
        try {
            let xElem = xEvent.target;
            if (xElem.className) {
                if (xElem.className == "delete_entry") {
                    this.deleteRow(xElem.value);
                }
            }
        }
        catch (e) {
            showError(e);
        }
    }

    deleteRow (iEntry) {
        this.lEntry[parseInt(iEntry)] = null;
        if (document.getElementById(this.sNodeId + "_row_" + iEntry)) {
            document.getElementById(this.sNodeId + "_row_" + iEntry).style.display = "none";
        }
        this.nEntry -= 1;
        this.showEntryNumber();
    }

    getEntries () {
        return this.lEntry.filter((e) => e !== null);
    }
}


const oGenerator = {

    sLemma: "",

    cMainTag: "",

    lFlexion: [],

    listen: function () {
        document.getElementById("lemma").addEventListener("keyup", () => { this.update(); }, false);
        // nom commun
        document.getElementById("tag_N").addEventListener("click", () => { this.update("N"); }, false);
        document.getElementById("nom_adj").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("nom").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("adj").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("N_epi").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("N_mas").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("N_fem").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("N_s").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("N_x").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("N_inv").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("lemma2").addEventListener("keyup", () => { this.update(); }, false);
        // nom propre
        document.getElementById("tag_M").addEventListener("click", () => { this.update("M"); }, false);
        document.getElementById("M1").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("M2").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("MP").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("M_epi").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("M_mas").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("M_fem").addEventListener("click", () => { this.update(); }, false);
        // verbe
        document.getElementById("tag_V").addEventListener("click", () => { this.update("V"); }, false);
        document.getElementById("v_i").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("v_t").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("v_n").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("v_p").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("v_m").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("v_ae").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("v_aa").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("v_ppas").addEventListener("click", () => { this.update(); }, false);
        document.getElementById("verbe_modele").addEventListener("keyup", () => { this.update(); }, false);
        // adverbe
        document.getElementById("tag_W").addEventListener("click", () => { this.update("W"); }, false);
        // autre
        document.getElementById("tag_X").addEventListener("click", () => { this.update("X"); }, false);
        document.getElementById("flexion").addEventListener("keyup", () => { this.update(); }, false);
        document.getElementById("tags").addEventListener("keyup", () => { this.update(); }, false);
        // ajout
        document.getElementById("add_to_lexicon").addEventListener("click", () => { this.addToLexicon(); }, false);
    },

    clear: function () {
        try {
            // nom commun
            document.getElementById("tag_N").checked = false;
            document.getElementById("nom_adj").checked = false;
            document.getElementById("nom").checked = false;
            document.getElementById("adj").checked = false;
            document.getElementById("N_epi").checked = false;
            document.getElementById("N_mas").checked = false;
            document.getElementById("N_fem").checked = false;
            document.getElementById("N_s").checked = false;
            document.getElementById("N_x").checked = false;
            document.getElementById("N_inv").checked = false;
            document.getElementById("lemma2").value = "";
            // nom propre
            document.getElementById("tag_M").checked = false;
            document.getElementById("M1").checked = false;
            document.getElementById("M2").checked = false;
            document.getElementById("MP").checked = false;
            document.getElementById("M_epi").checked = false;
            document.getElementById("M_mas").checked = false;
            document.getElementById("M_fem").checked = false;
            // verbe
            document.getElementById("tag_V").checked = false;
            document.getElementById("v_i").checked = false;
            document.getElementById("v_t").checked = false;
            document.getElementById("v_n").checked = false;
            document.getElementById("v_p").checked = false;
            document.getElementById("v_m").checked = false;
            document.getElementById("v_ae").checked = false;
            document.getElementById("v_aa").checked = false;
            document.getElementById("v_ppas").checked = true;
            document.getElementById("verbe_modele").value = "";
            // adverbe
            document.getElementById("tag_W").checked = false;
            // autre
            document.getElementById("tag_X").checked = false;
            document.getElementById("flexion").value = "";
            document.getElementById("tags").value = "";
        }
        catch (e) {
            showError(e);
        }
    },

    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;
            }
        }
    },

    update: function (cTag=null) {
        if (cTag !== null) {
            this.setMainTag(cTag);
        }
        try {
            this.lFlexion = [];
            this.sLemma = document.getElementById("lemma").value.trim();
            if (this.sLemma.length > 0) {
                switch (this.cMainTag) {
                    case "N":
                        if (!this.getRadioValue("pos_nom_commun") || !this.getRadioValue("genre_nom_commun")) {
                            break;
                        }
                        let sTag = this.getRadioValue("pos_nom_commun") + this.getRadioValue("genre_nom_commun");
                        switch (this.getRadioValue("pluriel_nom_commun")) {
                            case "s":
                                this.lFlexion.push([this.sLemma, sTag+":s/*"]);
                                this.lFlexion.push([this.sLemma+"s", sTag+":p/*"]);
                                break;
                            case "x":
                                this.lFlexion.push([this.sLemma, sTag+":s/*"]);
                                this.lFlexion.push([this.sLemma+"x", sTag+":p/*"]);
                                break;
                            case "i":
                                this.lFlexion.push([this.sLemma, sTag+":i/*"]);
                                break;
                        }
                        let sLemma2 = document.getElementById("lemma2").value.trim();
                        if (sLemma2.length > 0  &&  this.getRadioValue("pos_nom_commun2")  &&  this.getRadioValue("genre_nom_commun2")) {
                            let sTag2 = this.getRadioValue("pos_nom_commun2") + this.getRadioValue("genre_nom_commun2");
                            switch (this.getRadioValue("pluriel_nom_commun2")) {
                                case "s":
                                    this.lFlexion.push([sLemma2, sTag2+":s/*"]);
                                    this.lFlexion.push([sLemma2+"s", sTag2+":p/*"]);
                                    break;
                                case "x":
                                    this.lFlexion.push([sLemma2, sTag2+":s/*"]);
                                    this.lFlexion.push([sLemma2+"x", sTag2+":p/*"]);
                                    break;
                                case "i":
                                    this.lFlexion.push([sLemma2, sTag2+":i/*"]);
                                    break;
                            }
                        }
                        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 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();
                            if (sVerbPattern.length == 0) {
                                // utilisation du générateur de conjugaison
                                let bVarPpas = document.getElementById("up_partpas").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);
                                    for (let [sTag1, dFlex] of oVerb.dConj.entries()) {
                                        if (sTag1 !== ":Q") {
                                            for (let [sTag2, sConj] of dFlex.entries()) {
                                                if (sTag2.startsWith(":") && sConj !== "") {
                                                    this.lFlexion.push([sConj, ":V" + oVerb.cGroup + "_" + sVerbTag + sTag1 + sTag2]);
                                                }
                                            }
                                        } else {
                                            // participes passés
                                            if (dFlex.get(":Q3") !== "") {
                                                if (dFlex.get(":Q2") !== "") {
                                                    this.lFlexion.push([dFlex.get(":Q1"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:m:s/*"]);
                                                    this.lFlexion.push([dFlex.get(":Q2"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:m:p/*"]);
                                                } else {
                                                    this.lFlexion.push([dFlex.get(":Q1"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:m:i/*"]);
                                                }
                                                this.lFlexion.push([dFlex.get(":Q3"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:f:s/*"]);
                                                this.lFlexion.push([dFlex.get(":Q4"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:A:f:p/*"]);
                                            } else {
                                                this.lFlexion.push([dFlex.get(":Q1"), ":V" + oVerb.cGroup + "_" + sVerbTag + ":Q:e:i/*"]);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    }
                    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 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();
                        let sTags = document.getElementById("tags").value.trim();
                        if (sFlexion.length > 0 && sTags.startsWith(":")) {
                            this.lFlexion.push([sFlexion, sTags]);
                        }
                        break;
                }
            }
            oGenWordsTable.fill(this.lFlexion);
        }
        catch (e) {
            showError(e);
        }
    },

    getRadioValue: function (sName) {
        if (document.getElementById(sName)) {
            for (let xNode of document.getElementById(sName).children) {
                if (xNode.selected) {
                    return xNode.value;
                }
            }
        }
        return null;
    },

    createFlexLemmaTagArray: function () {
        let lEntry = [];
        for (let [sFlex, sTags] of oGenWordsTable.getEntries()) {
            lEntry.push([sFlex, this.sLemma, sTags]);
        }
        return lEntry;
    },

    addToLexicon: function () {
        try {
            oLexiconTable.addEntries(this.createFlexLemmaTagArray());
            oGenWordsTable.clear();
            document.getElementById("lemma").value = "";
            document.getElementById("lemma").focus();
            enableElement("save_button");
            this.clear();
            this.cMainTag = "";
        }
        catch (e) {
            showError(e);
        }
    }
}


const oBinaryDict = {
    
    oIBDAWG: null,

    load: function () {
        let sJSON = prefs.getCharPref("oPersonalDictionary");
        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");
        }
    },

    setDictData: function (nEntries, sDate) {
        document.getElementById("dic_num_entries").textContent = nEntries;
        document.getElementById("dic_save_date").textContent = sDate;
    },

    listen: function () {
        document.getElementById("export_button").addEventListener("click", () => { this.export(); }, false);
        //document.getElementById("import_button").addEventListener("click", () => { this.import(); }, false);
    },

    build: function () {
        let xProgressNode = document.getElementById("wait_progress");
        let lEntry = oLexiconTable.getEntries();
        if (lEntry.length > 0) {
            let oDAWG = new DAWG(lEntry, "S", "fr", "Français", "Dictionnaire personnel", xProgressNode);
            let oJSON = oDAWG.createBinaryJSON(1);
            prefs.setCharPref("oPersonalDictionary", JSON.stringify(oJSON));
            this.oIBDAWG = new IBDAWG(oJSON);
            this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate);
            browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sType: "personal", oDict: oJSON}, dInfo: {} });
        }
        enableElement("export_button");
    },

    import: function () {
        console.log("import");
    },

    export: function () {
        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");

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173

174
175
176
177
178

179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205


206
207
208
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://grammarchecker/content/lex_editor.css" type="text/css"?>

<!DOCTYPE dialog SYSTEM "chrome://grammarchecker/locale/lex_editor.dtd">

<dialog
  id="grammalecte-lexicon-editor-window"
  title="&window.title;"
  orient="vertical"
  buttons="accept, cancel"
  ondialogaccept="oOptControl.save();"
  ondialogcancel="return;"
  defaultButton="accept"
  width="500"
  onload="document.getElementById('grammalecte-lexicon-editor-window').centerWindowOnScreen();"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <!-- Other elements go here -->
  <hbox>
    <label class="dictionary" value="Dictionnaire personnel" />
    <label class="dic_text dic_saved_date_label" value="Enregistré le :" />
    <label class="dic_text dic_saved_date" value="·" />
    <label class="dic_text dic_num_entries" value="0" />
    <label class="dic_text dic_num_entries_label" value="entrées" />
    <button id="export" label="Exporter" />
  </hbox>

  <tabbox id="tabs" selectedIndex="0">
    <tabs>
      <tab label="&tab.editor.label;"/>
      <tab label="&tab.lexicon.label;"/>
    </tabs>

    <tabpanels>

      <!-- NEW WORD -->
      <tabpanel orient="vertical">
        
        <hbox>
          
          <vbox>
            <dialogheader title="Nouveau mot (lemme)" description="Générateur" />
            <textbox id="lemma" value="" />

            <checkbox class="subsection" label="Nom et adjectif" />
            <hbox class="m_left">
              <radiogroup orient="vertical">
                <radio id="o_pos_nom_adj" class="option" label="Nom et adjectif" />
                <radio id="o_pos_nom" class="option" label="Nom" />
                <radio id="o_pos_adj" class="option" label="Adjectif" />
              </radiogroup>
              <radiogroup orient="vertical">
                <radio id="o_pos_epi" class="option" label="épicène" />
                <radio id="o_pos_mas" class="option" label="masculin" />
                <radio id="o_pos_fem" class="option" label="féminin" />
              </radiogroup>
              <radiogroup orient="vertical">
                <radio id="o_pos_s" class="option" label="pluriel en ·s" />
                <radio id="o_pos_x" class="option" label="pluriel en ·x" />
                <radio id="o_pos_inv" class="option" label="invariable" />
              </radiogroup>

            </hbox>
            <vbox class="m_left2">
              <label class="subsection" value="[optionnel] Autre forme (masculine, féminine, variante…)" />
              <textbox id="lemma2" value="" />
              <hbox>
                <radiogroup orient="vertical">
                  <radio id="o_pos_nom_adj2" class="option" label="Nom et adjectif" />
                  <radio id="o_pos_nom2" class="option" label="Nom" />
                  <radio id="o_pos_adj2" class="option" label="Adjectif" />
                </radiogroup>
                <radiogroup orient="vertical">
                  <radio id="o_pos_epi2" class="option" label="épicène" />
                  <radio id="o_pos_mas2" class="option" label="masculin" />
                  <radio id="o_pos_fem2" class="option" label="féminin" />
                </radiogroup>
                <radiogroup orient="vertical">
                  <radio id="o_pos_s2" class="option" label="pluriel en ·s" />
                  <radio id="o_pos_x2" class="option" label="pluriel en ·x" />
                  <radio id="o_pos_inv2" class="option" label="invariable" />
                </radiogroup>
              </hbox>
            </vbox>

            <checkbox class="subsection" label="Nom propre" />
            <hbox class="m_left">
              <radiogroup orient="vertical">
                <radio id="o_pos_M1" class="option" label="Prénom" />
                <radio id="o_pos_M2" class="option" label="Patronyme" />
                <radio id="o_pos_MP" class="option" label="Autre" />
              </radiogroup>
              <radiogroup orient="vertical">
                <radio id="o_pos_epi" class="option" label="épicène" />
                <radio id="o_pos_mas" class="option" label="masculin" />
                <radio id="o_pos_fem" class="option" label="féminin" />
              </radiogroup>
            </hbox>              

            <checkbox class="subsection" label="Verbe" />
            <hbox class="m_left">
              <vbox>
                <checkbox id="o_v_i" class="v_usage" label="intransitif" />
                <checkbox id="o_v_t" class="v_usage" label="transitif" />
                <checkbox id="o_v_n" class="v_usage" label="transitif indirect" />
                <checkbox id="o_v_p" class="v_usage" label="pronominal" />
                <checkbox id="o_v_m" class="v_usage" label="impersonnel" />
              </vbox>
              <vbox>
                <label value="Auxilaire avec le passé composé" />
                <checkbox id="o_v_ae" class="v_usage" label="être" />
                <checkbox id="o_v_aa" class="v_usage" label="avoir" />
                <label value="" />
                <checkbox id="o_ppas" class="v_usage" label="Participes passés variables" />
              </vbox>
            </hbox>
            <hbox class="m_left">
              <label class="subsection" value="Verbe modèle [optionnel]" />
              <textbox id="v_pattern" class="v_textbox" value="" />
            </hbox>

            <checkbox class="subsection" label="Adverbe" />

            <checkbox class="subsection" label="Autre" />
            <vbox class="m_left">
              <hbox>
                <label class="subsection other_label" value="Flexion" />
                <textbox id="flexion" class="other_textbox" value="" />
              </hbox>
              <hbox>
                <label class="subsection other_label" value="Étiquettes" />
                <textbox id="tags" class="other_textbox" value="" />
              </hbox>
            </vbox>
          </vbox>

          <vbox>
            <dialogheader title="Mots générés" description="" />
            <listbox id="generated_words">

              <listhead>
                <listheader label="Flexions"/>
                <listheader label="Étiquettes"/>
              </listhead>

              <listcols>
                <listcol flex="1"/>
                <listcol flex="1"/>
              </listcols>

              <!--<listitem>
                <listcell label="George"/>
                <listcell label="House"/>
              </listitem>-->
              
            </listbox>

            <hbox>
              <button id="add_to_lexicon" label="Ajouter au lexique" />
              <button id="delete_selection" label="Effacer la sélection" />
            </hbox>
          </vbox>
        </hbox>
      </tabpanel>

      <!-- LEXICON -->
      <tabpanel orient="vertical">
        <dialogheader title="&dialogheader.lexicon.label;" description="" />
        <hbox>
          <vbox>
            <hbox>
              <label class="info_label" value="Nombre d’entrées : " />
              <label class="data" value="0" />
            </hbox>

            <button id="save" label="Enregistrer" />            
          </vbox>

          <vbox>
            <listbox id="lexicon">

              <listhead>
                <listheader label="Flexions"/>
                <listheader label="Lemmes"/>
                <listheader label="Étiquettes"/>
              </listhead>

              <listcols>
                <listcol flex="4"/>
                <listcol flex="3"/>
                <listcol flex="4"/>
              </listcols>

              <!--<listitem>
                <listcell label="George"/>
                <listcell label="House Painter"/>
                <listcell label="House"/>
              </listitem>-->

            </listbox>
          </vbox>
        </hbox>
      </tabpanel>

    </tabpanels>

  </tabbox>



  <script type="application/x-javascript" src="lex_editor.js" />

</dialog>










|
|

|











|



















|

|
|
|
|

|
|
|
|

|
|
|
|

<





|
|
|
|

|
|
|
|

|
|
|
|




|

|
|
|
|

|
|
|
|



|


|
|
|
|
|



|
|

|




|


|

|














|
>










|


|
|

>

















>
|



|
>












|



|
|









>
>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://grammarchecker/content/lex_editor.css" type="text/css"?>

<!DOCTYPE dialog SYSTEM "chrome://grammarchecker/locale/lex_editor.dtd">

<dialog
  id="grammalecte-lexicon-editor-window"
  title="&window.title;"
  orient="vertical"
  buttons="cancel"
  buttonlabelcancel="&button.cancel.label;"
  ondialogcancel="return;"
  defaultButton="cancel"
  width="500"
  onload="document.getElementById('grammalecte-lexicon-editor-window').centerWindowOnScreen();"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <!-- Other elements go here -->
  <hbox>
    <label class="dictionary" value="Dictionnaire personnel" />
    <label class="dic_text dic_saved_date_label" value="Enregistré le :" />
    <label class="dic_text dic_saved_date" value="·" />
    <label class="dic_text dic_num_entries" value="0" />
    <label class="dic_text dic_num_entries_label" value="entrées" />
    <button id="export_button" label="Exporter" />
  </hbox>

  <tabbox id="tabs" selectedIndex="0">
    <tabs>
      <tab label="&tab.editor.label;"/>
      <tab label="&tab.lexicon.label;"/>
    </tabs>

    <tabpanels>

      <!-- NEW WORD -->
      <tabpanel orient="vertical">
        
        <hbox>
          
          <vbox>
            <dialogheader title="Nouveau mot (lemme)" description="Générateur" />
            <textbox id="lemma" value="" />

            <checkbox id="tag_N" class="subsection" label="Nom et adjectif" />
            <hbox class="m_left">
              <radiogroup id="pos_nom_commun" orient="vertical">
                <radio id="nom_adj" class="option" label="Nom et adjectif" value=":N:A" />
                <radio id="nom" class="option" label="Nom" value=":N" />
                <radio id="adj" class="option" label="Adjectif" value=":A" />
              </radiogroup>
              <radiogroup id="genre_nom_commun" orient="vertical">
                <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" />
              </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">
                  <radio id="nom_adj2" class="option" label="Nom et adjectif" value=":N:A" />
                  <radio id="nom2" class="option" label="Nom" value=":N" />
                  <radio id="adj2" class="option" label="Adjectif" value=":A" />
                </radiogroup>
                <radiogroup id="genre_nom_commun2" orient="vertical">
                  <radio id="N_epi2" class="option" label="épicène" value=":e" />
                  <radio id="N_mas2" class="option" label="masculin" value=":m" />
                  <radio id="N_fem2" class="option" label="féminin" value=":f" />
                </radiogroup>
                <radiogroup id="pluriel_nom_commun2" orient="vertical">
                  <radio id="N_s2" class="option" label="pluriel en ·s" value="s" />
                  <radio id="N_x2" class="option" label="pluriel en ·x" value="x" />
                  <radio id="N_inv2" class="option" label="invariable" value="inv" />
                </radiogroup>
              </hbox>
            </vbox>

            <checkbox id="tag_M" class="subsection" label="Nom propre" />
            <hbox class="m_left">
              <radiogroup id="pos_nom_propre" orient="vertical">
                <radio id="M1" class="option" label="Prénom" value=":M1" />
                <radio id="M2" class="option" label="Patronyme" value=":M2" />
                <radio id="MP" class="option" label="Autre" value=":MP" />
              </radiogroup>
              <radiogroup id="genre_nom_propre" orient="vertical">
                <radio id="M_epi" class="option" label="épicène" value=":e" />
                <radio id="M_mas" class="option" label="masculin" value=":m" />
                <radio id="M_fem" class="option" label="féminin" value=":f" />
              </radiogroup>
            </hbox>              

            <checkbox id="tag_V" class="subsection" label="Verbe" />
            <hbox class="m_left">
              <vbox>
                <checkbox id="v_i" class="v_usage" label="intransitif" />
                <checkbox id="v_t" class="v_usage" label="transitif" />
                <checkbox id="v_n" class="v_usage" label="transitif indirect" />
                <checkbox id="v_p" class="v_usage" label="pronominal" />
                <checkbox id="v_m" class="v_usage" label="impersonnel" />
              </vbox>
              <vbox>
                <label value="Auxilaire avec le passé composé" />
                <checkbox id="v_ae" class="v_usage" label="être" />
                <checkbox id="v_aa" class="v_usage" label="avoir" />
                <label value="" />
                <checkbox id="v_ppas" class="v_usage" label="Participes passés variables" />
              </vbox>
            </hbox>
            <hbox class="m_left">
              <label class="subsection" value="Verbe modèle [optionnel]" />
              <textbox id="verbe_modele" class="v_textbox" value="" />
            </hbox>

            <checkbox id="tag_W" class="subsection" label="Adverbe" />

            <checkbox id="tag_X" class="subsection" label="Autre" />
            <vbox class="m_left">
              <hbox>
                <label class="subsection other_label" value="Flexion" />
                <textbox id="flexion" class="other_textbox" value="" />
              </hbox>
              <hbox>
                <label class="subsection other_label" value="Étiquettes" />
                <textbox id="tags" class="other_textbox" value="" />
              </hbox>
            </vbox>
          </vbox>

          <vbox>
            <dialogheader title="Mots générés" description="" />
            <listbox id="generated_words_table">
              <!--
              <listhead>
                <listheader label="Flexions"/>
                <listheader label="Étiquettes"/>
              </listhead>

              <listcols>
                <listcol flex="1"/>
                <listcol flex="1"/>
              </listcols>

              <listitem>
                <listcell label="George"/>
                <listcell label="House"/>
              </listitem>
              -->
            </listbox>
            <progressmeter id="progress_new_words" value="0"/>
            <hbox>
              <button id="add_to_lexicon" label="Ajouter au lexique" />
              <button id="delete_selection" label="Effacer la sélection" />
            </hbox>
          </vbox>
        </hbox>
      </tabpanel>

      <!-- LEXICON -->
      <tabpanel orient="vertical">
        <dialogheader title="&dialogheader.lexicon.label;" description="" />
        <hbox>
          <vbox>
            <hbox>
              <label class="info_label" value="Nombre d’entrées : " />
              <label class="data" value="0" />
            </hbox>
            <progressmeter id="progress_lexicon" value="0"/>
            <button id="save_button" label="Enregistrer" />        
          </vbox>

          <vbox>
            <listbox id="lexicon_table">
              <!--
              <listhead>
                <listheader label="Flexions"/>
                <listheader label="Lemmes"/>
                <listheader label="Étiquettes"/>
              </listhead>

              <listcols>
                <listcol flex="4"/>
                <listcol flex="3"/>
                <listcol flex="4"/>
              </listcols>

              <listitem>
                <listcell label="George"/>
                <listcell label="House Painter"/>
                <listcell label="House"/>
              </listitem>
              -->
            </listbox>
          </vbox>
        </hbox>
      </tabpanel>

    </tabpanels>

  </tabbox>

  <script type="application/x-javascript" src="resource://grammalecte/content/fr/conj.js" />
  <script type="application/x-javascript" src="resource://grammalecte/content/fr/conj_generator.js" />
  <script type="application/x-javascript" src="lex_editor.js" />

</dialog>

Modified gc_lang/fr/tb/defaults/preferences/grammarchecker.js from [be777f5bf3] to [768dd584ea].

1
2
3
4
5
6
7
8
9
10
11



pref("extensions.grammarchecker.urlpref1", "http://localhost:8081");
pref("extensions.grammarchecker.urlpref2", "https://languagetool.org:8081/");
pref("extensions.grammarchecker.langpref", "en");
pref("extensions.grammarchecker.mothertongue", "");
pref("extensions.grammarchecker.sGCOptions", "");
pref("extensions.grammarchecker.sTFOptions", "");
pref("extensions.grammarchecker.bDictModern", false);
pref("extensions.grammarchecker.bDictClassic", true);
pref("extensions.grammarchecker.bDictReform", false);
pref("extensions.grammarchecker.bDictClassicReform", false);
pref("extensions.grammarchecker.bCheckSignature", true);



<
<
<
<







>
>
>




1
2
3
4
5
6
7
8
9
10




pref("extensions.grammarchecker.sGCOptions", "");
pref("extensions.grammarchecker.sTFOptions", "");
pref("extensions.grammarchecker.bDictModern", false);
pref("extensions.grammarchecker.bDictClassic", true);
pref("extensions.grammarchecker.bDictReform", false);
pref("extensions.grammarchecker.bDictClassicReform", false);
pref("extensions.grammarchecker.bCheckSignature", true);
pref("extensions.grammarchecker.oExtendedDictionary", "");
pref("extensions.grammarchecker.oCommunityDictionary", "");
pref("extensions.grammarchecker.oPersonalDictionary", "");

Modified gc_lang/fr/tb/locale/en/lex_editor.dtd from [424843c364] to [8c1160e1e9].

1
2


3
4
5
6
7
8
9
<!ENTITY window.title "Grammalecte · Éditeur lexical">



<!ENTITY dialogheader.newword.label "Nouveau mot">
<!ENTITY dialogheader.lexicon.label "Votre lexique">

<!ENTITY button.export.label "DDDD">

<!ENTITY tab.editor.label "Ajout">
<!ENTITY tab.lexicon.label "Lexique">
|

>
>
|
|

<
<
|
|
1
2
3
4
5
6
7


8
9
<!ENTITY window.title "Grammalecte · Lexical editor lexical">

<!ENTITY button.cancel.label "Close">

<!ENTITY dialogheader.newword.label "New word">
<!ENTITY dialogheader.lexicon.label "Your lexicon">



<!ENTITY tab.editor.label "Add">
<!ENTITY tab.lexicon.label "Lexicon">

Modified gc_lang/fr/tb/locale/fr/lex_editor.dtd from [424843c364] to [9672553e7e].

1


2
3
4
5
6
7
8
9
<!ENTITY window.title "Grammalecte · Éditeur lexical">



<!ENTITY dialogheader.newword.label "Nouveau mot">
<!ENTITY dialogheader.lexicon.label "Votre lexique">

<!ENTITY button.export.label "DDDD">

<!ENTITY tab.editor.label "Ajout">
<!ENTITY tab.lexicon.label "Lexique">

>
>




<
<


1
2
3
4
5
6
7


8
9
<!ENTITY window.title "Grammalecte · Éditeur lexical">

<!ENTITY button.cancel.label "Fermer">

<!ENTITY dialogheader.newword.label "Nouveau mot">
<!ENTITY dialogheader.lexicon.label "Votre lexique">



<!ENTITY tab.editor.label "Ajout">
<!ENTITY tab.lexicon.label "Lexique">