Grammalecte  Check-in [86199c55ea]

Overview
Comment:[core][fr] suggestions: remove empty suggestions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr | core
Files: files | file ages | folders
SHA3-256: 86199c55ead7a4543c3c1d060b54dd26e9dda0adfad8b37d1624c03ab59aab9b
User & Date: olr on 2020-02-06 06:51:53
Original Comment: [core][fr] suggestions: remove empyt suggestions
Other Links: manifest | tags
Context
2020-02-06
06:56
[fr] mauvaise sélection de token check-in: 760ad1946f user: olr tags: trunk, fr
06:51
[core][fr] suggestions: remove empty suggestions check-in: 86199c55ea user: olr tags: trunk, fr, core
2020-02-04
14:06
[lo] lexicon editor as non modal dialog check-in: 2239a762bd user: olr tags: trunk, lo
Changes

Modified gc_lang/fr/grammalecte.update.xml from [0bbc0658e4] to [517c65e062].

1
2
3
4

5
6

7
8
1
2
3

4
5

6
7
8



-
+

-
+


<?xml version="1.0" encoding="UTF-8"?>
<description xmlns="http://openoffice.org/extensions/update/2006" xmlns:xlink="http://www.w3.org/1999/xlink">
  <identifier value="French.linguistic.resources.from.Dicollecte.by.OlivierR"/>
  <version value="6.5.1" />
  <version value="7.0" />
  <update-download>
    <src xlink:href="https://extensions.libreoffice.org/extensions/grammalecte/1-6.0/@@download/file/Grammalecte-fr-v1.6.0.oxt" />
    <src xlink:href="https://extensions.libreoffice.org/extensions/grammalecte/1-7.0/@@download/file/Grammalecte-fr-v1.7.0.oxt" />
  </update-download>
</description>

Modified gc_lang/fr/modules-js/gce_suggestions.js from [15ad3aeb1e] to [de44ba5567].

265
266
267
268
269
270
271

272
273
274
275
276
277
278
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279







+







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

function suggSing (sFlex, bSelfSugg=false) {
296
297
298
299
300
301
302

303
304
305
306
307
308
309
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311







+







    }
    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 (bSelfSugg && aSugg.size == 0) {
        aSugg.add(sFlex);
    }
    aSugg.delete("");
    if (aSugg.size > 0) {
        return Array.from(aSugg).join("|");
    }
    return "";
}

function suggMasSing (sFlex, bSuggSimil=false) {
331
332
333
334
335
336
337

338
339
340
341
342
343
344
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347







+







        }
    }
    if (bSuggSimil) {
        for (let e of phonet.selectSimil(sFlex, ":m:[si]")) {
            aSugg.add(e);
        }
    }
    aSugg.delete("");
    if (aSugg.size > 0) {
        return Array.from(aSugg).join("|");
    }
    return "";
}

function suggMasPlur (sFlex, bSuggSimil=false) {
370
371
372
373
374
375
376

377
378
379
380
381
382
383
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387







+







        }
    }
    if (bSuggSimil) {
        for (let e of phonet.selectSimil(sFlex, ":m:[pi]")) {
            aSugg.add(e);
        }
    }
    aSugg.delete("");
    if (aSugg.size > 0) {
        return Array.from(aSugg).join("|");
    }
    return "";
}


404
405
406
407
408
409
410

411
412
413
414
415
416
417
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422







+







        }
    }
    if (bSuggSimil) {
        for (let e of phonet.selectSimil(sFlex, ":f:[si]")) {
            aSugg.add(e);
        }
    }
    aSugg.delete("");
    if (aSugg.size > 0) {
        return Array.from(aSugg).join("|");
    }
    return "";
}

function suggFemPlur (sFlex, bSuggSimil=false) {
437
438
439
440
441
442
443

444
445
446
447
448
449
450
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456







+







        }
    }
    if (bSuggSimil) {
        for (let e of phonet.selectSimil(sFlex, ":f:[pi]")) {
            aSugg.add(e);
        }
    }
    aSugg.delete("");
    if (aSugg.size > 0) {
        return Array.from(aSugg).join("|");
    }
    return "";
}

function hasFemForm (sFlex) {

Modified gc_lang/fr/modules/gce_suggestions.py from [fa34b4b458] to [74625aeb66].

198
199
200
201
202
203
204

205
206
207
208
209
210
211
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212







+







        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 and bSelfSugg and sFlex.endswith(("s", "x", "S", "X")):
        aSugg.add(sFlex)
    aSugg.discard("")
    if aSugg:
        return "|".join(aSugg)
    return ""


def suggSing (sFlex, bSelfSugg=True):
    "returns singular forms assuming sFlex is plural"
220
221
222
223
224
225
226

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







+







            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 bSelfSugg and not aSugg:
        aSugg.add(sFlex)
    aSugg.discard("")
    if aSugg:
        return "|".join(aSugg)
    return ""


def suggMasSing (sFlex, bSuggSimil=False):
    "returns masculine singular forms"
247
248
249
250
251
252
253

254
255
256
257
258
259
260
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263







+







            if conj.hasConj(sVerb, ":PQ", ":Q1") and conj.hasConj(sVerb, ":PQ", ":Q3"):
                # We also check if the verb has a feminine form.
                # If not, we consider it’s better to not suggest the masculine one, as it can be considered invariable.
                aSugg.add(conj.getConj(sVerb, ":PQ", ":Q1"))
    if bSuggSimil:
        for e in phonet.selectSimil(sFlex, ":m:[si]"):
            aSugg.add(e)
    aSugg.discard("")
    if aSugg:
        return "|".join(aSugg)
    return ""


def suggMasPlur (sFlex, bSuggSimil=False):
    "returns masculine plural forms"
277
278
279
280
281
282
283

284
285
286
287
288
289
290
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294







+







                sSugg = conj.getConj(sVerb, ":PQ", ":Q1")
                # it is necessary to filter these flexions, like “succédé” or “agi” that are not masculine plural.
                if sSugg.endswith("s"):
                    aSugg.add(sSugg)
    if bSuggSimil:
        for e in phonet.selectSimil(sFlex, ":m:[pi]"):
            aSugg.add(e)
    aSugg.discard("")
    if aSugg:
        return "|".join(aSugg)
    return ""


def suggFemSing (sFlex, bSuggSimil=False):
    "returns feminine singular forms"
302
303
304
305
306
307
308

309
310
311
312
313
314
315
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320







+







            # a verb
            sVerb = cr.getLemmaOfMorph(sMorph)
            if conj.hasConj(sVerb, ":PQ", ":Q3"):
                aSugg.add(conj.getConj(sVerb, ":PQ", ":Q3"))
    if bSuggSimil:
        for e in phonet.selectSimil(sFlex, ":f:[si]"):
            aSugg.add(e)
    aSugg.discard("")
    if aSugg:
        return "|".join(aSugg)
    return ""


def suggFemPlur (sFlex, bSuggSimil=False):
    "returns feminine plural forms"
327
328
329
330
331
332
333

334
335
336
337
338
339
340
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346







+







            # a verb
            sVerb = cr.getLemmaOfMorph(sMorph)
            if conj.hasConj(sVerb, ":PQ", ":Q4"):
                aSugg.add(conj.getConj(sVerb, ":PQ", ":Q4"))
    if bSuggSimil:
        for e in phonet.selectSimil(sFlex, ":f:[pi]"):
            aSugg.add(e)
    aSugg.discard("")
    if aSugg:
        return "|".join(aSugg)
    return ""


def hasFemForm (sFlex):
    "return True if there is a feminine form of <sFlex>"