Grammalecte  Check-in [f06fcf9200]

Overview
Comment:[core][fr] suggestions pour les verbes composés
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr | core
Files: files | file ages | folders
SHA3-256: f06fcf9200bb31876f787574d8fec7c1661713aa7c521f93a91efd8058334c49
User & Date: olr on 2021-01-15 11:49:40
Other Links: manifest | tags
Context
2021-01-16
11:51
[fr] ajustements (tests) check-in: c2148721bf user: olr tags: trunk, fr
2021-01-15
11:49
[core][fr] suggestions pour les verbes composés check-in: f06fcf9200 user: olr tags: trunk, fr, core
2021-01-14
19:51
[fr] ajustements (tests), faux positifs check-in: e64973fcf5 user: olr tags: trunk, fr
Changes

Modified gc_lang/fr/modules-js/gce_suggestions.js from [70c1996830] to [916bb2d5db].

69
70
71
72
73
74
75
76
77
78
79
80
81















82
83
84
85
86
87
88
        let aSugg2 = funcSugg2(sFlex);
        if (aSugg2.size > 0) {
            aSugg.add(aSugg2);
        }
    }
    if (aSugg.size > 0) {
        if (bVC) {
            return Array.from(aSugg).map((sSugg) => { return sSugg + sSfx; }).join("|");
        }
        return Array.from(aSugg).join("|");
    }
    return "";
}
















function suggVerbPpas (sFlex, sWhat=null) {
    let aSugg = new Set();
    for (let sStem of gc_engine.oSpellChecker.getLemma(sFlex)) {
        let tTags = conj._getTags(sStem);
        if (tTags) {
            if (!sWhat) {







|





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
        let aSugg2 = funcSugg2(sFlex);
        if (aSugg2.size > 0) {
            aSugg.add(aSugg2);
        }
    }
    if (aSugg.size > 0) {
        if (bVC) {
            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);
        if (tTags) {
            if (!sWhat) {
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
            if (conj._hasConjWithTags(tTags, ":E", ":2p")) {
                aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2p"));
            }
        }
    }
    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).join("|");
    }
    return "";
}

function suggVerbInfi (sFlex) {







|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
            if (conj._hasConjWithTags(tTags, ":E", ":2p")) {
                aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2p"));
            }
        }
    }
    if (aSugg.size > 0) {
        if (bVC) {
            return Array.from(aSugg).map((sSugg) => joinVerbAndSuffix(sSugg, sSfx)).join("|");
        }
        return Array.from(aSugg).join("|");
    }
    return "";
}

function suggVerbInfi (sFlex) {
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
            for (let e of conj.getSimil(sWord, sMorph, bSubst)) {
                aSugg.add(e);
            }
        }
    }
    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).join("|");
    }
    return "";
}

function suggCeOrCet (sWord) {







|







632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
            for (let e of conj.getSimil(sWord, sMorph, bSubst)) {
                aSugg.add(e);
            }
        }
    }
    if (aSugg.size > 0) {
        if (bVC) {
            return Array.from(aSugg).map((sSugg) => joinVerbAndSuffix(sSugg, sSfx)).join("|");
        }
        return Array.from(aSugg).join("|");
    }
    return "";
}

function suggCeOrCet (sWord) {

Modified gc_lang/fr/modules/gce_suggestions.py from [7693ca0dd3] to [af90e8e3f3].

48
49
50
51
52
53
54
55
56
57
58











59
60
61
62
63
64
65
                    aSugg.add(conj._getConjWithTags(sStem, tTags, sTense, sWho))
    if funcSugg2:
        aSugg2 = funcSugg2(sFlex)
        if aSugg2:
            aSugg.add(aSugg2)
    if aSugg:
        if bVC:
            aSugg = list(map(lambda sSug: sSug + sSfx, aSugg))
        return "|".join(aSugg)
    return ""













def suggVerbPpas (sFlex, sPattern=None):
    "suggest past participles for <sFlex>"
    aSugg = set()
    for sStem in _oSpellChecker.getLemma(sFlex):
        tTags = conj._getTags(sStem)
        if tTags:







|



>
>
>
>
>
>
>
>
>
>
>







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
                    aSugg.add(conj._getConjWithTags(sStem, tTags, sTense, sWho))
    if funcSugg2:
        aSugg2 = funcSugg2(sFlex)
        if aSugg2:
            aSugg.add(aSugg2)
    if aSugg:
        if bVC:
            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 <sFlex>"
    aSugg = set()
    for sStem in _oSpellChecker.getLemma(sFlex):
        tTags = conj._getTags(sStem)
        if tTags:
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
                aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2s"))
            if conj._hasConjWithTags(tTags, ":E", ":1p"):
                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))
        return "|".join(aSugg)
    return ""


def suggVerbInfi (sFlex):
    "returns infinitive forms of <sFlex>"
    return "|".join([ sStem  for sStem in _oSpellChecker.getLemma(sFlex)  if conj.isVerb(sStem) ])







|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
                aSugg.add(conj._getConjWithTags(sStem, tTags, ":E", ":2s"))
            if conj._hasConjWithTags(tTags, ":E", ":1p"):
                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 = [ joinVerbAndSuffix(sSugg, sSfx)  for sSugg in aSugg ]
        return "|".join(aSugg)
    return ""


def suggVerbInfi (sFlex):
    "returns infinitive forms of <sFlex>"
    return "|".join([ sStem  for sStem in _oSpellChecker.getLemma(sFlex)  if conj.isVerb(sStem) ])
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
    aSugg = phonet.selectSimil(sWord, sPattern)
    if not aSugg or not bSubst:
        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))
        return "|".join(aSugg)
    return ""


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







|







482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
    aSugg = phonet.selectSimil(sWord, sPattern)
    if not aSugg or not bSubst:
        for sMorph in _oSpellChecker.getMorph(sWord):
            aSugg.update(conj.getSimil(sWord, sMorph, bSubst))
            break
    if aSugg:
        if bVC:
            aSugg = [ joinVerbAndSuffix(sSugg, sSfx)  for sSugg in aSugg ]
        return "|".join(aSugg)
    return ""


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

Modified gc_lang/fr/rules.grx from [211d70a754] to [019b4bfc74].

2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
TEST: mais {{aie-je}} seulement le choix ?                                              ->> ai-je
TEST: {{bluff-je}}                                                                      ->> bluffe-je
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: {{box-t-on}}                                                                      ->> boxe-t-on
TEST: {{Prends-elle}}                                                                   ->> Prend-elle
TEST: {{boycott-elle}} cette marque ?                                                   ->> boycotte-elle
TEST: {{Menthe-elles}} souvent ?                                                        ->> Mentent-elles
TEST: {{demandent-elle}}                                                                ->> demande-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: {{é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
TEST: {{boycott-ils}}                                                                   ->> boycottent-ils
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: {{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 ?









|


|

|

|











|







2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
TEST: mais {{aie-je}} seulement le choix ?                                              ->> ai-je
TEST: {{bluff-je}}                                                                      ->> bluffe-je
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-on}}                                                                   ->> Attaque-t-on
TEST: {{box-t-on}}                                                                      ->> boxe-t-on
TEST: {{Prends-elle}}                                                                   ->> Prend-elle
TEST: {{boycott-elle}} cette marque ?                                                   ->> boycotte-t-elle
TEST: {{Menthe-elles}} souvent ?                                                        ->> Mentent-elles
TEST: {{demandent-elle}}                                                                ->> demande-t-elle|demandent-elles
TEST: {{viennent-il}} demain ?                                                          ->> viennent-ils|vient-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
TEST: {{boycott-ils}}                                                                   ->> boycottent-ils
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-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 ?