Grammalecte  Check-in [5cf9b11203]

Overview
Comment:[fx] lexicon editor: update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | multid
Files: files | file ages | folders
SHA3-256: 5cf9b11203334e756f880e588ad2aa6e357b990ec141ae91598bc7105c8213df
User & Date: olr on 2018-03-11 12:43:07
Other Links: branch diff | manifest | tags
Context
2018-03-11
19:14
[fr][js][bug] conj generator: forgotten parameter check-in: 4b78e35e83 user: olr tags: fr, multid
12:43
[fx] lexicon editor: update check-in: 5cf9b11203 user: olr tags: fx, multid
10:43
[lo] lexicon editor: update check-in: d5d52dde75 user: olr tags: lo, multid
Changes

Modified gc_lang/fr/webext/panel/lex_editor.css from [134b1e8bcd] to [be224332e1].

112
113
114
115
116
117
118





119
120
121
122
123
124
125
...
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
    display: none;
    padding: 10px;
}

.container {
    display: flex;
}






.block {
    flex-grow: 1;
    margin: 5px;
    padding: 10px 15px 15px 15px;
    background-color: hsl(0, 10%, 96%);
    border-radius: 3px;
................................................................................
    width: 100%;
    height: 4px;
}

table {
    border: 1px solid hsl(210, 10%, 50%);
    width: 100%;
    min-height: 200px;
}
th {
    padding: 5px 10px;
    border-left: 1px solid hsl(210, 10%, 90%);
    text-align: left;
}
td {







>
>
>
>
>







 







<







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
243
244
245
246
247
248
249

250
251
252
253
254
255
256
    display: none;
    padding: 10px;
}

.container {
    display: flex;
}
.dic_container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.block {
    flex-grow: 1;
    margin: 5px;
    padding: 10px 15px 15px 15px;
    background-color: hsl(0, 10%, 96%);
    border-radius: 3px;
................................................................................
    width: 100%;
    height: 4px;
}

table {
    border: 1px solid hsl(210, 10%, 50%);
    width: 100%;

}
th {
    padding: 5px 10px;
    border-left: 1px solid hsl(210, 10%, 90%);
    text-align: left;
}
td {

Modified gc_lang/fr/webext/panel/lex_editor.html from [673f7e7e9b] to [abda213ba3].

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

      <div id="buttons" class="container">
        <div id="lexicon_button" class="main_button">Lexique</div>
        <div id="add_word_button" class="main_button">Ajout</div>
      </div>

      <div class="big_block">
        <h3>Dictionnaire</h3>
        <div id="export_button" class="fright">
          Exporter
        </div>
        <div id="import_button" class="fright">
          Importer
        </div>
        <p>
          Dictionnaire <span id="dic_name">personnel</span> : <span id="dic_num_entries">0</span> entrées.<br/>
          Date d’enregistrement : <span id="dic_save_date">néant</span>.
        </p>
        <progress id="wait_progress" value="0"></progress>
      </div>

      <div id="add_word_page">
        <div class="columns">
          <div id="word_generator">
            <h2>Nouveau mot (lemme)</h2>







|
|
|
|
|
|
|
<
<
<
<







14
15
16
17
18
19
20
21
22
23
24
25
26
27




28
29
30
31
32
33
34

      <div id="buttons" class="container">
        <div id="lexicon_button" class="main_button">Lexique</div>
        <div id="add_word_button" class="main_button">Ajout</div>
      </div>

      <div class="big_block">
        <div class="dic_container">
          <div><h3>Dictionnaire personnel.</h3></div>
          <div>Enregistré le : <span id="dic_save_date">néant</span>.</div>
          <div><span id="dic_num_entries">0</span> entrées.</div>
          <div id="export_button" class="fright">Exporter</div>
          <div id="import_button" class="fright">Importer</div>
        </div>




        <progress id="wait_progress" value="0"></progress>
      </div>

      <div id="add_word_page">
        <div class="columns">
          <div id="word_generator">
            <h2>Nouveau mot (lemme)</h2>

Modified gc_lang/fr/webext/panel/lex_editor.js from [d1ce88a730] to [04fabe98f3].

178
179
180
181
182
183
184


185
186
187
188
189
190
191
...
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
...
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
...
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
...
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
    getEntries () {
        return this.lEntry.filter((e) => e !== null);
    }
}


const oGenerator = {



    cMainTag: "",

    lFlexion: [],

    listen: function () {
        document.getElementById("editor").addEventListener("click", (xEvent) => { this.onSelectionClick(xEvent); }, false);
................................................................................
        }
    },

    update: function () {
        try {
            this.lFlexion = [];
            let sGenderTag = "";
            let sLemma = document.getElementById("lemma").value.trim();
            if (sLemma.length > 0) {
                switch (this.cMainTag) {
                    case "N":
                        if (!this.getRadioValue("POS") || !this.getRadioValue("genre")) {
                            break;
                        }
                        let sTag = this.getRadioValue("POS") + this.getRadioValue("genre");
                        switch (this.getRadioValue("pluriel")) {
                            case "s":
                                this.lFlexion.push([sLemma, sTag+":s/*"]);
                                this.lFlexion.push([sLemma+"s", sTag+":p/*"]);
                                break;
                            case "x":
                                this.lFlexion.push([sLemma, sTag+":s/*"]);
                                this.lFlexion.push([sLemma+"x", sTag+":p/*"]);
                                break;
                            case "i":
                                this.lFlexion.push([sLemma, sTag+":i/*"]);
                                break;
                        }
                        let sLemma2 = document.getElementById("lemma2").value.trim();
                        if (sLemma2.length > 0  &&  this.getRadioValue("POS2")  &&  this.getRadioValue("genre2")) {
                            let sTag2 = this.getRadioValue("POS2") + this.getRadioValue("genre2");
                            switch (this.getRadioValue("pluriel2")) {
                                case "s":
................................................................................
                                case "i":
                                    this.lFlexion.push([sLemma2, sTag2+":i/*"]);
                                    break;
                            }
                        }
                        break;
                    case "V": {
                        if (!sLemma.endsWith("er") && !sLemma.endsWith("ir") && !sLemma.endsWith("re")) {
                            break;
                        }
                        sLemma = 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(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(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]);
                                                }
                                            }
................................................................................
                                    }
                                }
                            }
                        }
                        break;
                    }
                    case "W":
                        sLemma = sLemma.toLowerCase();
                        this.lFlexion.push([sLemma, ":W/*"]);
                        break;
                    case "M1":
                        sLemma = sLemma.slice(0,1).toUpperCase() + sLemma.slice(1);
                        sGenderTag = this.getRadioValue("genre_m1");
                        if (sGenderTag) {
                            this.lFlexion.push([sLemma, ":M1"+sGenderTag+":i/*"]);
                        }
                        break;
                    case "M2":
                        sLemma = sLemma.slice(0,1).toUpperCase() + sLemma.slice(1);
                        sGenderTag = this.getRadioValue("genre_m2");
                        if (sGenderTag) {
                            this.lFlexion.push([sLemma, ":M2"+sGenderTag+":i/*"]);
                        }
                        break;
                    case "MP":
                        sGenderTag = this.getRadioValue("genre_mp");
                        if (sGenderTag) {
                            this.lFlexion.push([sLemma, ":MP"+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]);
................................................................................
        if (document.querySelector('input[name="' + sName + '"]:checked')) {
            return document.querySelector('input[name="' + sName + '"]:checked').value;
        }
        return null;
    },

    createFlexLemmaTagArray: function () {
        let sLemma = document.getElementById("lemma").value.trim();
        let lEntry = [];
        for (let [sFlex, sTags] of oGenWordsTable.getEntries()) {
            lEntry.push([sFlex, sLemma, sTags]);
        }
        return lEntry;
    },

    addToLexicon: function () {
        try {
            oLexiconTable.addEntries(this.createFlexLemmaTagArray());







>
>







 







|
|








|
|


|
|


|







 







|


|







 







|





|







 







|
|


|


|



|


|





|







 







<


|







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
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
...
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
...
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
...
437
438
439
440
441
442
443

444
445
446
447
448
449
450
451
452
453
    getEntries () {
        return this.lEntry.filter((e) => e !== null);
    }
}


const oGenerator = {

    sLemma: "",

    cMainTag: "",

    lFlexion: [],

    listen: function () {
        document.getElementById("editor").addEventListener("click", (xEvent) => { this.onSelectionClick(xEvent); }, false);
................................................................................
        }
    },

    update: function () {
        try {
            this.lFlexion = [];
            let sGenderTag = "";
            this.sLemma = document.getElementById("lemma").value.trim();
            if (this.sLemma.length > 0) {
                switch (this.cMainTag) {
                    case "N":
                        if (!this.getRadioValue("POS") || !this.getRadioValue("genre")) {
                            break;
                        }
                        let sTag = this.getRadioValue("POS") + this.getRadioValue("genre");
                        switch (this.getRadioValue("pluriel")) {
                            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("POS2")  &&  this.getRadioValue("genre2")) {
                            let sTag2 = this.getRadioValue("POS2") + this.getRadioValue("genre2");
                            switch (this.getRadioValue("pluriel2")) {
                                case "s":
................................................................................
                                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]);
                                                }
                                            }
................................................................................
                                    }
                                }
                            }
                        }
                        break;
                    }
                    case "W":
                        this.sLemma = this.sLemma.toLowerCase();
                        this.lFlexion.push([this.sLemma, ":W/*"]);
                        break;
                    case "M1":
                        this.sLemma = this.sLemma.slice(0,1).toUpperCase() + this.sLemma.slice(1);
                        sGenderTag = this.getRadioValue("genre_m1");
                        if (sGenderTag) {
                            this.lFlexion.push([this.sLemma, ":M1"+sGenderTag+":i/*"]);
                        }
                        break;
                    case "M2":
                        this.sLemma = this.sLemma.slice(0,1).toUpperCase() + this.sLemma.slice(1);
                        sGenderTag = this.getRadioValue("genre_m2");
                        if (sGenderTag) {
                            this.lFlexion.push([this.sLemma, ":M2"+sGenderTag+":i/*"]);
                        }
                        break;
                    case "MP":
                        sGenderTag = this.getRadioValue("genre_mp");
                        if (sGenderTag) {
                            this.lFlexion.push([this.sLemma, ":MP"+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]);
................................................................................
        if (document.querySelector('input[name="' + sName + '"]:checked')) {
            return document.querySelector('input[name="' + sName + '"]:checked').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());