Grammalecte  Diff

Differences From Artifact [6333a4318e]:

To Artifact [14bc22abf3]:


177
178
179
180
181
182
183
184

185
186
187
188
189
190
191
177
178
179
180
181
182
183

184
185
186
187
188
189
190
191







-
+







    if sWordToAgree:
        lMorph = _oSpellChecker.getMorph(sFlex)
        if not lMorph:
            return ""
        sGender = cr.getGender(lMorph)
        if sGender == ":m":
            return suggMasPlur(sFlex)
        elif sGender == ":f":
        if sGender == ":f":
            return suggFemPlur(sFlex)
    aSugg = set()
    if "-" not in sFlex:
        if sFlex.endswith("l"):
            if sFlex.endswith("al") and len(sFlex) > 2 and _oSpellChecker.isValid(sFlex[:-1]+"ux"):
                aSugg.add(sFlex[:-1]+"ux")
            if sFlex.endswith("ail") and len(sFlex) > 3 and _oSpellChecker.isValid(sFlex[:-2]+"ux"):
415
416
417
418
419
420
421
422

423
424
425
426
427
428
429
415
416
417
418
419
420
421

422
423
424
425
426
427
428
429







-
+







    return ""


def suggCeOrCet (sWord):
    "suggest “ce” or “cet” or both according to the first letter of <sWord>"
    if re.match("(?i)[aeéèêiouyâîï]", sWord):
        return "cet"
    if sWord[0:1] == "h" or sWord[0:1] == "H":
    if sWord[0:1] in "hH":
        return "ce|cet"
    return "ce"


def suggLesLa (sWord):
    "suggest “les” or “la” according to <sWord>"
    if any( ":p" in sMorph  for sMorph in _oSpellChecker.getMorph(sWord) ):
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
499
500
501
502
503
504
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
499
500
501
502
503
504







-
+








-
+

-
+

-
+

-
+

-
+

-
+







def formatNF (s):
    "typography: format NF reference (norme française)"
    try:
        m = re.match("NF[  -]?(C|E|P|Q|S|X|Z|EN(?:[  -]ISO|))[  -]?([0-9]+(?:[/‑-][0-9]+|))", s)
        if not m:
            return ""
        return "NF " + m.group(1).upper().replace(" ", " ").replace("-", " ") + " " + m.group(2).replace("/", "‑").replace("-", "‑")
    except:
    except (re.error, IndexError):
        traceback.print_exc()
        return "# erreur #"


def undoLigature (c):
    "typography: split ligature character <c> in several chars"
    if c == "fi":
        return "fi"
    elif c == "fl":
    if c == "fl":
        return "fl"
    elif c == "ff":
    if c == "ff":
        return "ff"
    elif c == "ffi":
    if c == "ffi":
        return "ffi"
    elif c == "ffl":
    if c == "ffl":
        return "ffl"
    elif c == "ſt":
    if c == "ſt":
        return "ft"
    elif c == "st":
    if c == "st":
        return "st"
    return "_"




_xNormalizedCharsForInclusiveWriting = str.maketrans({