Index: gc_lang/fr/modules-js/gce_suggestions.js ================================================================== --- gc_lang/fr/modules-js/gce_suggestions.js +++ gc_lang/fr/modules-js/gce_suggestions.js @@ -71,16 +71,31 @@ aSugg.add(aSugg2); } } if (aSugg.size > 0) { if (bVC) { - return Array.from(aSugg).map((sSugg) => { return sSugg + sSfx; }).join("|"); + return Array.from(aSugg).map((sSugg) => joinVerbAndSuffix(sSugg, sSfx)).join("|"); } return Array.from(aSugg).join("|"); } return ""; } + +function joinVerbAndSuffix (sFlex, sSfx) { + if (/^-[tT]-/.test(sSfx) && /[tdTD]$/.test(sFlex)) { + return sFlex + sSfx.slice(2); + } + if (/[eacEAC]$/.test(sFlex)) { + if (/-(?:en|y)$/i.test(sSfx)) { + return sFlex + "s" + sSfx; + } + if (/-(?:ie?l|elle|on)$/i.test(sSfx)) { + return sFlex + "-t" + sSfx; + } + } + return sFlex + sSfx; +} function suggVerbPpas (sFlex, sWhat=null) { let aSugg = new Set(); for (let sStem of gc_engine.oSpellChecker.getLemma(sFlex)) { let tTags = conj._getTags(sStem); @@ -192,11 +207,11 @@ } } } if (aSugg.size > 0) { if (bVC) { - return Array.from(aSugg).map((sSugg) => { return ((sSugg.endsWith("e") || sSugg.endsWith("a")) && (sSfx == "-en" || sSfx == "-y")) ? sSugg + "s" + sSfx : sSugg + sSfx; }).join("|"); + return Array.from(aSugg).map((sSugg) => joinVerbAndSuffix(sSugg, sSfx)).join("|"); } return Array.from(aSugg).join("|"); } return ""; } @@ -619,11 +634,11 @@ } } } if (aSugg.size > 0) { if (bVC) { - return Array.from(aSugg).map((sSugg) => { return ((sSugg.endsWith("e") || sSugg.endsWith("a")) && (sSfx == "-en" || sSfx == "-y")) ? sSugg + "s" + sSfx : sSugg + sSfx; }).join("|"); + return Array.from(aSugg).map((sSugg) => joinVerbAndSuffix(sSugg, sSfx)).join("|"); } return Array.from(aSugg).join("|"); } return ""; } Index: gc_lang/fr/modules/gce_suggestions.py ================================================================== --- gc_lang/fr/modules/gce_suggestions.py +++ gc_lang/fr/modules/gce_suggestions.py @@ -50,14 +50,25 @@ aSugg2 = funcSugg2(sFlex) if aSugg2: aSugg.add(aSugg2) if aSugg: if bVC: - aSugg = list(map(lambda sSug: sSug + sSfx, aSugg)) + aSugg = [ joinVerbAndSuffix(sSugg, sSfx) for sSugg in aSugg ] return "|".join(aSugg) return "" + +def joinVerbAndSuffix (sFlex, sSfx): + if sSfx.startswith(("-t-", "-T-")) and sFlex.endswith(("t", "d", "T", "D")): + return sFlex + sSfx[2:] + if sFlex.endswith(("e", "a", "c", "E", "A", "C")): + if re.match("(?i)-(?:en|y)$", sSfx): + return sFlex + "s" + sSfx + if re.match("(?i)-(?:ie?l|elle|on)$", sSfx): + return sFlex + "-t" + sSfx + return sFlex + sSfx + def suggVerbPpas (sFlex, sPattern=None): "suggest past participles for " aSugg = set() for sStem in _oSpellChecker.getLemma(sFlex): @@ -145,11 +156,11 @@ aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":1p")) if conj._hasConjWithTags(tTags, ":E", ":2p"): aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2p")) if aSugg: if bVC: - aSugg = list(map(lambda sSug: sSug + "s" + sSfx if (sSfx == "-en" or sSfx == "-y") and sSug.endswith(("e", "a")) else sSug + sSfx, aSugg)) + aSugg = [ joinVerbAndSuffix(sSugg, sSfx) for sSugg in aSugg ] return "|".join(aSugg) return "" def suggVerbInfi (sFlex): @@ -473,11 +484,11 @@ for sMorph in _oSpellChecker.getMorph(sWord): aSugg.update(conj.getSimil(sWord, sMorph, bSubst)) break if aSugg: if bVC: - aSugg = list(map(lambda sSug: sSug + "s" + sSfx if (sSfx == "-en" or sSfx == "-y") and sSug.endswith(("e", "a")) else sSug + sSfx, aSugg)) + aSugg = [ joinVerbAndSuffix(sSugg, sSfx) for sSugg in aSugg ] return "|".join(aSugg) return "" def suggCeOrCet (sWord): Index: gc_lang/fr/rules.grx ================================================================== --- gc_lang/fr/rules.grx +++ gc_lang/fr/rules.grx @@ -2422,18 +2422,18 @@ TEST: {{Prit-je}} ->> Pris-je TEST: {{prix-je}} le temps d’y parvenir ? Oui. ->> pris-je|prie-je TEST: {{Peut-tu}} ->> Peux-tu TEST: {{peu-tu}} revenir chez moi ? ->> peux-tu TEST: {{Peux-il}} ->> Peut-il -TEST: {{Attaques-t-on}} ->> Attaque-t-on +TEST: {{Attaques-on}} ->> Attaque-t-on TEST: {{box-t-on}} ->> boxe-t-on TEST: {{Prends-elle}} ->> Prend-elle -TEST: {{boycott-elle}} cette marque ? ->> boycotte-elle +TEST: {{boycott-elle}} cette marque ? ->> boycotte-t-elle TEST: {{Menthe-elles}} souvent ? ->> Mentent-elles -TEST: {{demandent-elle}} ->> demande-elle|demandent-elles +TEST: {{demandent-elle}} ->> demande-t-elle|demandent-elles TEST: {{viennent-il}} demain ? ->> viennent-ils|vient-il -TEST: {{prix-t-il}} ->> prit-t-il|prie-t-il|prît-t-il +TEST: {{prix-t-il}} ->> prit-il|prie-t-il|prît-il TEST: {{étais-ce}} trop demander ->> était-ce TEST: {{était-se}} cela, la vérité ineffable ? ->> était-ce TEST: {{étai-ce}} notre destinée de souffrir ? ->> était-ce|étaie-ce TEST: {{étaient-se}} ces hommes-là qui allaient nous guider dans les montagnes ? ->> étaient-ce TEST: {{attaquant-ils}} ->> attaquent-ils @@ -2441,11 +2441,11 @@ TEST: {{prendrons-elles}} un verre avec moi ? ->> prendront-elles TEST: {{bloc-elles}} ->> bloquent-elles TEST: {{vient-elles}} demain ? ->> viennent-elles TEST: {{savent-iel}} ->> sait-iel|savent-iels TEST: {{peux-iel}} ->> peut-iel -TEST: {{boycott-iel}} ->> boycotte-iel +TEST: {{boycott-iel}} ->> boycotte-t-iel TEST: {{connaît-iels}} ->> connaissent-iels TEST: {{boycott-iels}} ->> boycottent-iels TEST: Était-ce des femmes de ce pays ? TEST: Eh ! dit Athos, ne sont-ce pas des braconniers qu’on arrête là-bas ? TEST: Le moteur choisi convient-il ?