Grammalecte  Check-in [fb9f2914eb]

Overview
Comment:[core][fr] générateur de conjugaisons comme module (déplacement de fichiers)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fr | core | multid
Files: files | file ages | folders
SHA3-256: fb9f2914eb180c594fda6414a40e26d6f7d765f772d0d4e3f7038eab71546fd1
User & Date: olr on 2018-03-06 15:38:18
Other Links: branch diff | manifest | tags
Context
2018-03-06
16:44
[lo][fr][py] générateur de conjugaisons: nouvelles fonctions check-in: 456aa2a2aa user: olr tags: fr, lo, multid
15:38
[core][fr] générateur de conjugaisons comme module (déplacement de fichiers) check-in: fb9f2914eb user: olr tags: fr, core, multid
15:08
[tb] lexicon editor: Ui update check-in: f077da7669 user: olr tags: tb, multid
Changes

Modified gc_lang/fr/config.ini from [4a9c6e6781] to [5898e7ef09].

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
83
84
85
86
87
88
89

90
91
92
93
94
95
96







-







oxt/Dictionnaires/dictionaries.xcu = dictionaries.xcu
oxt/Dictionnaires/DictionarySwitcher.py = pythonpath/DictionarySwitcher.py
oxt/Dictionnaires/ds_strings.py = pythonpath/ds_strings.py
# Dictionary Options
oxt/DictOptions/DictOptions.py = pythonpath/DictOptions.py
oxt/DictOptions/do_strings.py = pythonpath/do_strings.py
oxt/DictOptions/LexiconEditor.py = pythonpath/LexiconEditor.py
oxt/DictOptions/lxe_conj_data.py = pythonpath/lxe_conj_data.py
oxt/DictOptions/lxe_strings.py = pythonpath/lxe_strings.py
# ContextMenu
oxt/ContextMenu/ContextMenu.py = ContextMenu.py
oxt/ContextMenu/jobs.xcu = config/jobs.xcu
# TextFormatter
oxt/TextFormatter/TextFormatter.py = pythonpath/TextFormatter.py
oxt/TextFormatter/tf_strings.py = pythonpath/tf_strings.py

Modified gc_lang/fr/modules-js/conj_generator.js from [465cbcd5b7] to [d3fa10cd2f].

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18










-
+







//  JavaScript

"use strict";

// beta stage, unfinished, may be useless or the root for a new way to generate flexions…

/*
    Règles de conjugaison
*/

const oConj = {
const conj_generator = {
    "V1_ppas": {
        "var": [
            [2,     "é",           ":Q:A:1ŝ:m:s/*",     false],
            [2,     "és",          ":Q:A:m:p/*",        false],
            [2,     "ée",          ":Q:A:f:s/*",        false],
            [2,     "ées",         ":Q:A:f:p/*",        false],
        ],

Name change from gc_lang/fr/oxt/DictOptions/lxe_conj_data.py to gc_lang/fr/modules/conj_generator.py.

Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [1e45d3395d] to [afd65cf50b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24












-




+







# Lexicon Editor
# by Olivier R.
# License: GPL 3

import unohelper
import uno
import json
import re
import traceback

import helpers
import lxe_strings
import lxe_conj_data
import grammalecte.graphspell as sc
import grammalecte.graphspell.dawg as dawg
import grammalecte.graphspell.ibdawg as ibdawg
import grammalecte.fr.conj as conj
import grammalecte.fr.conj_generator as conjgen

from com.sun.star.task import XJobExecutor
from com.sun.star.awt import XActionListener
from com.sun.star.awt import XKeyListener


def _waitPointer (funcDecorated):
405
406
407
408
409
410
411
412

413
414
415
416
417
418
419
405
406
407
408
409
410
411

412
413
414
415
416
417
418
419







-
+







                                # tables de conjugaison du 1er et du 2e groupe
                                cGroup = "1"  if sLemma.endswith("er")  else "2"
                                for nCut, sAdd, sFlexTags, sPattern in self._getConjRules(sLemma):
                                    if not sPattern or re.search(sPattern, sLemma):
                                        self.lGeneratedFlex.append((sLemma[0:-nCut]+sAdd, sLemma, ":V" + cGroup + "_" + sVerbTag + sFlexTags))
                                # participes passés
                                bPpasVar = "var"  if self.xV_pp.State  else "invar"
                                lPpasRules = lxe_conj_data.oConj["V1_ppas"][bPpasVar]  if sLemma.endswith("er")  else lxe_conj_data.oConj["V2_ppas"][bPpasVar]
                                lPpasRules = conjgen.oConj["V1_ppas"][bPpasVar]  if sLemma.endswith("er")  else conjgen.oConj["V2_ppas"][bPpasVar]
                                for nCut, sAdd, sFlexTags, sPattern in lPpasRules:
                                    if not sPattern or re.search(sPattern, sLemma):
                                        self.lGeneratedFlex.append((sLemma[0:-nCut]+sAdd, sLemma, ":V" + cGroup + "_" + sVerbTag + sFlexTags))
                        else:
                            # copie du motif d’un autre verbe : utilisation du conjugueur
                            if conj.isVerb(sVerbPattern):
                                oVerb = conj.Verb(sLemma, sVerbPattern)
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
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







-
+



-
-
+
+

-
+

-
-
+
+

-
-
-
+
+
+







                if sFlexion and sTags.startswith(":"):
                    self.lGeneratedFlex.append((sFlexion, sLemma, sTags))
        self._showGenWords()

    def _getConjRules (self, sVerb):
        if sVerb.endswith("ir"):
            # deuxième groupe
            return lxe_conj_data.oConj["V2"]
            return conjgen.oConj["V2"]
        elif sVerb.endswith("er"):
            # premier groupe, conjugaison en fonction de la terminaison du lemme
            # 5 lettres
            if sVerb[-5:] in lxe_conj_data.oConj["V1"]:
                return lxe_conj_data.oConj["V1"][sVerb[-5:]]
            if sVerb[-5:] in conjgen.oConj["V1"]:
                return conjgen.oConj["V1"][sVerb[-5:]]
            # 4 lettres
            if sVerb[-4:] in lxe_conj_data.oConj["V1"]:
            if sVerb[-4:] in conjgen.oConj["V1"]:
                if sVerb.endswith(("eler", "eter")):
                    return lxe_conj_data.oConj["V1"][sVerb[-4:]]["1"]
                return lxe_conj_data.oConj["V1"][sVerb[-4:]]
                    return conjgen.oConj["V1"][sVerb[-4:]]["1"]
                return conjgen.oConj["V1"][sVerb[-4:]]
            # 3 lettres
            if sVerb[-3:] in lxe_conj_data.oConj["V1"]:
                return lxe_conj_data.oConj["V1"][sVerb[-3:]]
            return lxe_conj_data.oConj["V1"]["er"]
            if sVerb[-3:] in conjgen.oConj["V1"]:
                return conjgen.oConj["V1"][sVerb[-3:]]
            return conjgen.oConj["V1"]["er"]
        else:
            # troisième groupe
            return [ [0, "", ":Y/*", false] ]

    def _showGenWords (self):
        xGridDataModel = self.xGridModelNew.GridDataModel
        xGridDataModel.removeAllRows()

Modified gc_lang/fr/webext/panel/lex_editor.html from [78fc49cfbe] to [81ed66a201].

302
303
304
305
306
307
308
309

310
311
312
313
302
303
304
305
306
307
308

309
310
311
312
313







-
+






        <script src="../grammalecte/graphspell/helpers.js"></script>
        <script src="../grammalecte/graphspell/str_transform.js"></script>
        <script src="../grammalecte/graphspell/dawg.js"></script>
        <script src="../grammalecte/graphspell/ibdawg.js"></script>
        <script src="../grammalecte/fr/conj.js"></script>
        <script src="lex_conj_data.js"></script>
        <script src="../grammalecte/fr/conj_generator.js"></script>
        <script src="lex_editor.js"></script>
    </body>
    
</html>

Modified gc_lang/fr/webext/panel/lex_editor.js from [7139f8d80b] to [5562be7fad].

364
365
366
367
368
369
370
371

372
373
374
375
376
377
378
364
365
366
367
368
369
370

371
372
373
374
375
376
377
378







-
+







                                for (let [nCut, sAdd, sFlexTags, sPattern] of this._getConjRules(sLemma)) {
                                    if (!sPattern || RegExp(sPattern).test(sLemma)) {
                                        this.addFlexion(sLemma.slice(0,-nCut)+sAdd, sLemma, ":V" + cGroup + "_" + sVerbTag + sFlexTags);
                                    }
                                }
                                // participes passés
                                let bPpasVar = (document.getElementById("up_partpas").checked) ? "var" : "invar";
                                let lPpasRules = (sLemma.endsWith("er")) ? oConj["V1_ppas"][bPpasVar] : oConj["V2_ppas"][bPpasVar];
                                let lPpasRules = (sLemma.endsWith("er")) ? conj_generator["V1_ppas"][bPpasVar] : conj_generator["V2_ppas"][bPpasVar];
                                for (let [nCut, sAdd, sFlexTags, sPattern] of lPpasRules) {
                                    if (!sPattern || RegExp(sPattern).test(sLemma)) {
                                        this.addFlexion(sLemma.slice(0,-nCut)+sAdd, sLemma, ":V" + cGroup + "_" + sVerbTag + sFlexTags);
                                    }
                                }
                            } else {
                                // copie du motif d’un autre verbe : utilisation du conjugueur
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
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







-
+



-
-
+
+


-
+

-
+

-
+


-
-
+
+

-
+







            showError(e);
        }
    },

    _getConjRules: function (sVerb) {
        if (sVerb.endsWith("ir")) {
            // deuxième groupe
            return oConj["V2"];
            return conj_generator["V2"];
        } else if (sVerb.endsWith("er")) {
            // premier groupe, conjugaison en fonction de la terminaison du lemme
            // 5 lettres
            if (sVerb.slice(-5) in oConj["V1"]) {
                return oConj["V1"][sVerb.slice(-5)];
            if (sVerb.slice(-5) in conj_generator["V1"]) {
                return conj_generator["V1"][sVerb.slice(-5)];
            }
            // 4 lettres
            if (sVerb.slice(-4) in oConj["V1"]) {
            if (sVerb.slice(-4) in conj_generator["V1"]) {
                if (sVerb.endsWith("eler") || sVerb.endsWith("eter")) {
                    return oConj["V1"][sVerb.slice(-4)]["1"];
                    return conj_generator["V1"][sVerb.slice(-4)]["1"];
                }
                return oConj["V1"][sVerb.slice(-4)];
                return conj_generator["V1"][sVerb.slice(-4)];
            }
            // 3 lettres
            if (sVerb.slice(-3) in oConj["V1"]) {
                return oConj["V1"][sVerb.slice(-3)];
            if (sVerb.slice(-3) in conj_generator["V1"]) {
                return conj_generator["V1"][sVerb.slice(-3)];
            }
            return oConj["V1"]["er"];
            return conj_generator["V1"]["er"];
        } else {
            // troisième groupe
            return [ [0, "", ":Y/*", false] ];
        }
    },

    getRadioValue: function (sName) {