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 @@ -224,11 +224,11 @@ 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 ""; @@ -264,17 +264,20 @@ 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); } - return Array.from(aSugg).join("|"); + if (aSugg.size > 0) { + return Array.from(aSugg).join("|"); + } + return ""; } -function suggSing (sFlex) { +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"); @@ -292,14 +295,17 @@ } } 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); } - return Array.from(aSugg).join("|"); + if (aSugg.size > 0) { + return Array.from(aSugg).join("|"); + } + return ""; } function suggMasSing (sFlex, bSuggSimil=false) { // returns masculine singular forms let aSugg = new Set(); Index: gc_lang/fr/modules/gce_suggestions.py ================================================================== --- gc_lang/fr/modules/gce_suggestions.py +++ gc_lang/fr/modules/gce_suggestions.py @@ -170,11 +170,11 @@ 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 "" @@ -198,16 +198,18 @@ 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) - return "|".join(aSugg) + if 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") @@ -218,13 +220,15 @@ 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) - return "|".join(aSugg) + if aSugg: + return "|".join(aSugg) + return "" def suggMasSing (sFlex, bSuggSimil=False): "returns masculine singular forms" aSugg = set()