Grammalecte  Check-in [553b8f7636]

Overview
Comment:[core][fr] update suggSing(), suggPlur()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr | core
Files: files | file ages | folders
SHA3-256: 553b8f7636255bc552e542a4c5f773ee885b2fb101f6d2677f004525706a985e
User & Date: olr on 2019-09-20 19:36:23
Other Links: manifest | tags
Context
2019-09-23
19:35
[fr] faux positif et ajustements check-in: 78eb1da9e5 user: olr tags: trunk, fr
2019-09-20
19:36
[core][fr] update suggSing(), suggPlur() check-in: 553b8f7636 user: olr tags: trunk, fr, core
19:35
[fr] couleurs: ajustement de priorité check-in: 79117e1929 user: olr tags: trunk, fr
Changes

Modified gc_lang/fr/modules-js/gce_suggestions.js from [130ef38b35] to [bf19a122b8].

222
223
224
225
226
227
228
229

230
231
232
233
234
235
236
222
223
224
225
226
227
228

229
230
231
232
233
234
235
236







-
+







        return Array.from(aSugg).join("|");
    }
    return "";
}

//// Nouns and adjectives

function suggPlur (sFlex, sWordToAgree=null) {
function suggPlur (sFlex, sWordToAgree=null, bSelfSugg=false) {
    // returns plural forms assuming sFlex is singular
    if (sWordToAgree) {
        let lMorph = _oSpellChecker.getMorph(sWordToAgree);
        if (lMorph.length === 0) {
            return "";
        }
        let sGender = cregex.getGender(lMorph);
262
263
264
265
266
267
268
269

270
271

272
273
274
275






276
277
278
279
280
281
282
262
263
264
265
266
267
268

269
270
271
272




273
274
275
276
277
278
279
280
281
282
283
284
285







-
+


+
-
-
-
-
+
+
+
+
+
+







    }
    if (_oSpellChecker.isValid(sFlex+"x")) {
        aSugg.add(sFlex+"x");
    }
    if (mfsp.hasMiscPlural(sFlex)) {
        mfsp.getMiscPlural(sFlex).forEach(function(x) { aSugg.add(x); });
    }
    if (aSugg.size == 0) {
    if (aSugg.size == 0 && bSelfSugg && (sFlex.endsWith("s") || sFlex.endsWith("x") || sFlex.endsWith("S") || sFlex.endsWith("X"))) {
        aSugg.add(sFlex);
    }
    if (aSugg.size > 0) {
    return Array.from(aSugg).join("|");
}

function suggSing (sFlex) {
        return Array.from(aSugg).join("|");
    }
    return "";
}

function suggSing (sFlex, bSelfSugg=false) {
    // returns singular forms assuming sFlex is plural
    let aSugg = new Set();
    if (sFlex.endsWith("ux")) {
        if (_oSpellChecker.isValid(sFlex.slice(0,-2)+"l")) {
            aSugg.add(sFlex.slice(0,-2)+"l");
        }
        if (_oSpellChecker.isValid(sFlex.slice(0,-2)+"il")) {
290
291
292
293
294
295
296
297

298
299

300



301
302
303
304
305
306
307
293
294
295
296
297
298
299

300
301
302
303

304
305
306
307
308
309
310
311
312
313







-
+


+
-
+
+
+







        if (_oSpellChecker.isValid(sFlex.slice(0,-2)+"IL")) {
            aSugg.add(sFlex.slice(0,-2)+"IL");
        }
    }
    if ((sFlex.endsWith("s") || sFlex.endsWith("x") || sFlex.endsWith("S") || sFlex.endsWith("X")) && _oSpellChecker.isValid(sFlex.slice(0,-1))) {
        aSugg.add(sFlex.slice(0,-1));
    }
    if (aSugg.size == 0) {
    if (bSelfSugg && aSugg.size == 0) {
        aSugg.add(sFlex);
    }
    if (aSugg.size > 0) {
    return Array.from(aSugg).join("|");
        return Array.from(aSugg).join("|");
    }
    return "";
}

function suggMasSing (sFlex, bSuggSimil=false) {
    // returns masculine singular forms
    let aSugg = new Set();
    for (let sMorph of _oSpellChecker.getMorph(sFlex)) {
        if (!sMorph.includes(":V")) {

Modified gc_lang/fr/modules/gce_suggestions.py from [0c23f58230] to [ea32074c34].

168
169
170
171
172
173
174
175

176
177
178
179
180
181
182
168
169
170
171
172
173
174

175
176
177
178
179
180
181
182







-
+







    if aSugg:
        return "|".join(aSugg)
    return ""


## Nouns and adjectives

def suggPlur (sFlex, sWordToAgree=None):
def suggPlur (sFlex, sWordToAgree=None, bSelfSugg=False):
    "returns plural forms assuming sFlex is singular"
    if sWordToAgree:
        lMorph = _oSpellChecker.getMorph(sFlex)
        if not lMorph:
            return ""
        sGender = cr.getGender(lMorph)
        if sGender == ":m":
196
197
198
199
200
201
202
203

204

205


206
207
208

209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

224

225


226
227
228
229
230
231
232
196
197
198
199
200
201
202

203
204
205

206
207
208
209

210
211
212
213
214
215
216
217
218
219
220
221
222
223
224

225
226
227

228
229
230
231
232
233
234
235
236







-
+

+
-
+
+


-
+














-
+

+
-
+
+







            aSugg.add(sFlex[:-2]+"UX")
    if _oSpellChecker.isValid(sFlex+"s"):
        aSugg.add(sFlex+"s")
    if _oSpellChecker.isValid(sFlex+"x"):
        aSugg.add(sFlex+"x")
    if mfsp.hasMiscPlural(sFlex):
        aSugg.update(mfsp.getMiscPlural(sFlex))
    if not aSugg:
    if not aSugg and bSelfSugg and sFlex.endswith(("s", "x", "S", "X")):
        aSugg.add(sFlex)
    if aSugg:
    return "|".join(aSugg)
        return "|".join(aSugg)
    return ""


def suggSing (sFlex):
def suggSing (sFlex, bSelfSugg=True):
    "returns singular forms assuming sFlex is plural"
    aSugg = set()
    if sFlex.endswith("ux"):
        if _oSpellChecker.isValid(sFlex[:-2]+"l"):
            aSugg.add(sFlex[:-2]+"l")
        if _oSpellChecker.isValid(sFlex[:-2]+"il"):
            aSugg.add(sFlex[:-2]+"il")
    if sFlex.endswith("UX"):
        if _oSpellChecker.isValid(sFlex[:-2]+"L"):
            aSugg.add(sFlex[:-2]+"L")
        if _oSpellChecker.isValid(sFlex[:-2]+"IL"):
            aSugg.add(sFlex[:-2]+"IL")
    if sFlex.endswith(("s", "x", "S", "X")) and _oSpellChecker.isValid(sFlex[:-1]):
        aSugg.add(sFlex[:-1])
    if not aSugg:
    if bSelfSugg and not aSugg:
        aSugg.add(sFlex)
    if aSugg:
    return "|".join(aSugg)
        return "|".join(aSugg)
    return ""


def suggMasSing (sFlex, bSuggSimil=False):
    "returns masculine singular forms"
    aSugg = set()
    for sMorph in _oSpellChecker.getMorph(sFlex):
        if not ":V" in sMorph: