Grammalecte  Diff

Differences From Artifact [afd65cf50b]:

To Artifact [2c842dcb12]:


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
                    c_m = "m"  if self.xV_m.State  else "_"
                    c_ae = "e"  if self.xV_ae.State  else "_"
                    c_aa = "a"  if self.xV_aa.State  else "_"
                    sVerbTag = c_i + c_t + c_n + c_p + c_m + c_ae + c_aa
                    if not sVerbTag.endswith("__") and not sVerbTag.startswith("____"):
                        sVerbPattern = self.xVpattern.Text.strip()
                        if not sVerbPattern:
                            if sLemma.endswith("er") or sLemma.endswith("ir"):
                                # 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 = 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)
                                for sTag1, dFlex in oVerb.dConj.items():
                                    if sTag1 != ":Q":
                                        for sTag2, sConj in dFlex.items():







<
|
<
<
<
<
<
<
<
|
<
|







397
398
399
400
401
402
403

404







405

406
407
408
409
410
411
412
413
                    c_m = "m"  if self.xV_m.State  else "_"
                    c_ae = "e"  if self.xV_ae.State  else "_"
                    c_aa = "a"  if self.xV_aa.State  else "_"
                    sVerbTag = c_i + c_t + c_n + c_p + c_m + c_ae + c_aa
                    if not sVerbTag.endswith("__") and not sVerbTag.startswith("____"):
                        sVerbPattern = self.xVpattern.Text.strip()
                        if not sVerbPattern:

                            # Utilisation du générateur de conjugaison







                            for sFlexion, sFlexTags in conjgen.conjugate(sLemma, sVerbTag, bool(self.xV_pp.State)):

                                self.lGeneratedFlex.append((sFlexion, sLemma, sFlexTags))
                        else:
                            # copie du motif d’un autre verbe : utilisation du conjugueur
                            if conj.isVerb(sVerbPattern):
                                oVerb = conj.Verb(sLemma, sVerbPattern)
                                for sTag1, dFlex in oVerb.dConj.items():
                                    if sTag1 != ":Q":
                                        for sTag2, sConj in dFlex.items():
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
                # Autre
                sFlexion = self.xFlexion.Text.strip()
                sTags = self.xTags.Text.strip()
                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 conjgen.oConj["V2"]
        elif sVerb.endswith("er"):
            # premier groupe, conjugaison en fonction de la terminaison du lemme
            # 5 lettres
            if sVerb[-5:] in conjgen.oConj["V1"]:
                return conjgen.oConj["V1"][sVerb[-5:]]
            # 4 lettres
            if sVerb[-4:] in conjgen.oConj["V1"]:
                if sVerb.endswith(("eler", "eter")):
                    return conjgen.oConj["V1"][sVerb[-4:]]["1"]
                return conjgen.oConj["V1"][sVerb[-4:]]
            # 3 lettres
            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()
        if not self.lGeneratedFlex:
            self.xAdd.Enabled = False
            return
        for i, (sFlexion, sLemma, sTag) in enumerate(self.lGeneratedFlex):







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







433
434
435
436
437
438
439






















440
441
442
443
444
445
446
                # Autre
                sFlexion = self.xFlexion.Text.strip()
                sTags = self.xTags.Text.strip()
                if sFlexion and sTags.startswith(":"):
                    self.lGeneratedFlex.append((sFlexion, sLemma, sTags))
        self._showGenWords()























    def _showGenWords (self):
        xGridDataModel = self.xGridModelNew.GridDataModel
        xGridDataModel.removeAllRows()
        if not self.lGeneratedFlex:
            self.xAdd.Enabled = False
            return
        for i, (sFlexion, sLemma, sTag) in enumerate(self.lGeneratedFlex):