Index: gc_lang/fr/modules/tests_modules.py ================================================================== --- gc_lang/fr/modules/tests_modules.py +++ gc_lang/fr/modules/tests_modules.py @@ -76,13 +76,13 @@ ("Co2", "CO₂"), ("emmppâiiiller", "empailler"), ("testt", "test"), ("apelaion", "appellation"), ("exsepttion", "exception"), - ("sintaxik", "syntaxique"), ("ebriete", "ébriété"), - ("ennormmement", "énormément") + ("ennormmement", "énormément"), + ("sintaxik", "syntaxique") ]: #with timeblock(sWord): for lSugg in self.oSpellChecker.suggest(sWrong): #print(sWord, "->", " ".join(lSugg)) self.assertIn(sSugg, lSugg) Index: gc_lang/fr/rules.grx ================================================================== --- gc_lang/fr/rules.grx +++ gc_lang/fr/rules.grx @@ -11810,10 +11810,18 @@ TEST: s’organiser, comme on put, {{à bas thon rond pu}} ->> à bâtons rompus TEST: actions {{à bâton rompu}} ->> à bâtons rompus TEST: discuter à bâtons rompus + +__conf_à_bon_port__ + !! à bon port ¡¡ + [à|a] bon [>porc|>pore|>port] + <<- /conf/ ->> à bon port && Locution adverbiale “à bon port”.|https://fr.wiktionary.org/wiki/%C3%A0_bon_port + +TEST: {{a bon porc}} ->> à bon port + __conf_à_cor_et_à_cri__ !! à cor et à cri ¡¡ [a|à] [corps|cor+s] [et|est|es|ait|ais|aies|é|è|ei|ai|aient] [à|a] [cri+s|crie+s|crit] <<- /loc/ ->> à cor et à cri && Locution adverbiale invariable. (Le cor est un instrument à vent utilisé pour la chasse.)|https://fr.wiktionary.org/wiki/%C3%A0_cor_et_%C3%A0_cri @@ -15795,11 +15803,11 @@ <<- /conf/ --1>> porc|porcs && Confusion. Pour évoquer l’animal, écrivez “porc”.|https://fr.wiktionary.org/wiki/porc >pore [qui|qué] [>pique|>pic] >porc [qui|qué] [>pique|>pic] >port [qui|qué] [>pique|>pic] - <<- morph(<1, ":D||>[(,]") ->> porc-épic|porcs-épics && Confusion générale ? Si vous parlez de l’animal, écrivez “porc-épic”.|https://fr.wiktionary.org/wiki/porc-%C3%A9pic + <<- /conf/ morph(<1, ":D||>[(,]") ->> porc-épic|porcs-épics && Confusion générale ? Si vous parlez de l’animal, écrivez “porc-épic”.|https://fr.wiktionary.org/wiki/porc-%C3%A9pic ## port [>pore|>porc] [de|d’] [plaisance|pêche] [>pore|>porc] [>maritime|>spatial] <<- /conf/ -1>> port|ports && Confusion. Pour évoquer un havre côtier où les bateaux accostent, écrivez “port”.|https://fr.wiktionary.org/wiki/port @@ -15809,11 +15817,10 @@ <<- /conf/ -2>> port && Confusion. Pour évoquer un havre côtier où les bateaux accostent, écrivez “port”.|https://fr.wiktionary.org/wiki/port frais [de|d’] [>pore|>porc] <<- /conf/ --1>> port && Confusion. Locution “frais de port”.|https://fr.wiktionary.org/wiki/frais_de_port - [>arriver|>parvenir] ?@:[WX]¿ [à|a] bon [>pore|>porc] [>accoster|>amarrer] ?@:[WX]¿ au [>pore|>porc] [>accoster|>amarrer] ?@:[WX]¿ à ce ?petit¿ [>pore|>porc] <<- /conf/ --1>> port && Confusion. Pour évoquer un havre côtier où les bateaux accostent, écrivez “port”.|https://fr.wiktionary.org/wiki/port [>pore|>porc] [usb|RJ45|DVI|HDMI|Ethernet|DisplayPort] @@ -15829,11 +15836,10 @@ TEST: un filet mignon de {{pore}} ->> porc TEST: j’en ai marre de bouffer du {{port}} ->> porc|porcs TEST: un {{porc qui pique}} ->> porc-épic|porcs-épics TEST: le {{pore}} de l’étoile jaune ->> port TEST: un petit {{porc}} de plaisance ->> port|ports -TEST: nous parvenons enfin à bon {{pore}} ->> port TEST: les frais de {{pore}} ->> port TEST: Accoste au {{porc}} ->> port TEST: le {{pore}} de La Rochelle ->> port TEST: Connecte le {{pore}} USB ->> port|ports TEST: transpirer par tous les {{porcs}} ->> pores Index: graphspell-js/str_transform.js ================================================================== --- graphspell-js/str_transform.js +++ graphspell-js/str_transform.js @@ -37,15 +37,15 @@ } return sNewWord.normalize("NFC"); }, _xTransCharsForSimplification: new Map([ - ['à', 'a'], ['é', 'é'], ['î', 'i'], ['ô', 'o'], ['û', 'u'], ['ÿ', 'y'], - ['â', 'a'], ['è', 'é'], ['ï', 'i'], ['ö', 'o'], ['ù', 'u'], ['ŷ', 'y'], - ['ä', 'a'], ['ê', 'é'], ['í', 'i'], ['ó', 'o'], ['ü', 'u'], ['ý', 'y'], - ['á', 'a'], ['ë', 'é'], ['ì', 'i'], ['ò', 'o'], ['ú', 'u'], ['ỳ', 'y'], - ['ā', 'a'], ['ē', 'é'], ['ī', 'i'], ['ō', 'o'], ['ū', 'u'], ['ȳ', 'y'], + ['à', 'a'], ['é', 'e'], ['î', 'i'], ['ô', 'o'], ['û', 'u'], ['ÿ', 'i'], ['y', 'i'], + ['â', 'a'], ['è', 'e'], ['ï', 'i'], ['ö', 'o'], ['ù', 'u'], ['ŷ', 'i'], + ['ä', 'a'], ['ê', 'e'], ['í', 'i'], ['ó', 'o'], ['ü', 'u'], ['ý', 'i'], + ['á', 'a'], ['ë', 'e'], ['ì', 'i'], ['ò', 'o'], ['ú', 'u'], ['ỳ', 'i'], + ['ā', 'a'], ['ē', 'e'], ['ī', 'i'], ['ō', 'o'], ['ū', 'u'], ['ȳ', 'i'], ['ç', 'c'], ['ñ', 'n'], ['œ', 'oe'], ['æ', 'ae'], ['ſ', 's'], ['ffi', 'ffi'], ['ffl', 'ffl'], ['ff', 'ff'], ['ſt', 'ft'], ['fi', 'fi'], ['fl', 'fl'], ['st', 'st'], ["⁰", "0"], ["¹", "1"], ["²", "2"], ["³", "3"], ["⁴", "4"], ["⁵", "5"], ["⁶", "6"], ["⁷", "7"], ["⁸", "8"], ["⁹", "9"], ["₀", "0"], ["₁", "1"], ["₂", "2"], ["₃", "3"], ["₄", "4"], ["₅", "5"], ["₆", "6"], ["₇", "7"], ["₈", "8"], ["₉", "9"], @@ -63,11 +63,11 @@ if (c != sWord.slice(i, i+1) || (c == 'e' && sWord.slice(i, i+2) != "ee")) { // exception for to avoid confusion between crée / créai sNewWord += c; } i++; } - return sNewWord.replace(/eau/g, "o").replace(/au/g, "o").replace(/ai/g, "éi").replace(/ei/g, "é").replace(/ph/g, "f"); + return sNewWord.replace(/eau/g, "o").replace(/au/g, "o").replace(/ei/g, "e").replace(/ai/g, "e").replace(/ph/g, "f"); }, cleanWord: function (sWord) { // word clean for the user who make commun and preditive error help suggest // remove letters repeated more than 2 times Index: graphspell/ibdawg.py ================================================================== --- graphspell/ibdawg.py +++ graphspell/ibdawg.py @@ -48,26 +48,26 @@ self.nMinDist = 1000 # Temporary sets self.aAllSugg = set() # All suggestions, even the one rejected self.dAccSugg = {} # Accepted suggestions # Parameters - - self.nSuggLimit = nSuggLimit - self.nTempSuggLimit = nSuggLimit * 6 + self.nSuggLimit = nSuggLimit # number of returned suggestions + self.nTempSuggLimit = nSuggLimit * 6 # limit of accepted suggestions (ends search over this limit) def addSugg (self, sSugg, nDeep=0): - "add a suggestion" + "add a suggestion to the suggestion list" if sSugg in self.aAllSugg: return self.aAllSugg.add(sSugg) nSimDist = st.distanceSift4(self.sSimplifiedWord, st.simplifyWord(sSugg)) - st.showDistance(self.sSimplifiedWord, st.simplifyWord(sSugg)) + #st.showDistance(self.sSimplifiedWord, st.simplifyWord(sSugg)) if nSimDist < self.nMinDist: self.nMinDist = nSimDist if nSimDist <= (self.nMinDist + 1): - nDist = st.distanceJaroWinkler(self.sWord, sSugg) - st.showDistance(self.sWord, sSugg) + nDist = min(st.distanceDamerauLevenshtein(self.sWord, sSugg), st.distanceDamerauLevenshtein(self.sSimplifiedWord, st.simplifyWord(sSugg))) + #print(">", end="") + #st.showDistance(self.sWord, sSugg) self.dAccSugg[sSugg] = min(nDist, nSimDist+1) if len(self.dAccSugg) > self.nTempSuggLimit: self.nDistLimit = -1 # suggest() ends searching when this variable = -1 self.nDistLimit = min(self.nDistLimit, self.nMinDist+1) Index: graphspell/str_transform.py ================================================================== --- graphspell/str_transform.py +++ graphspell/str_transform.py @@ -30,15 +30,15 @@ "nomalization NFC and removing ligatures" return unicodedata.normalize("NFC", sWord.translate(_xTransCharsForSpelling)) _xTransCharsForSimplification = str.maketrans({ - 'à': 'a', 'é': 'é', 'î': 'i', 'ô': 'o', 'û': 'u', 'ÿ': 'y', - 'â': 'a', 'è': 'é', 'ï': 'i', 'ö': 'o', 'ù': 'u', 'ŷ': 'y', - 'ä': 'a', 'ê': 'é', 'í': 'i', 'ó': 'o', 'ü': 'u', 'ý': 'y', - 'á': 'a', 'ë': 'é', 'ì': 'i', 'ò': 'o', 'ú': 'u', 'ỳ': 'y', - 'ā': 'a', 'ē': 'é', 'ī': 'i', 'ō': 'o', 'ū': 'u', 'ȳ': 'y', + 'à': 'a', 'é': 'e', 'î': 'i', 'ô': 'o', 'û': 'u', 'ÿ': 'i', 'y': 'i', + 'â': 'a', 'è': 'e', 'ï': 'i', 'ö': 'o', 'ù': 'u', 'ŷ': 'i', + 'ä': 'a', 'ê': 'e', 'í': 'i', 'ó': 'o', 'ü': 'u', 'ý': 'i', + 'á': 'a', 'ë': 'e', 'ì': 'i', 'ò': 'o', 'ú': 'u', 'ỳ': 'i', + 'ā': 'a', 'ē': 'e', 'ī': 'i', 'ō': 'o', 'ū': 'u', 'ȳ': 'i', 'ç': 'c', 'ñ': 'n', 'œ': 'oe', 'æ': 'ae', 'ſ': 's', 'ffi': 'ffi', 'ffl': 'ffl', 'ff': 'ff', 'ſt': 'ft', 'fi': 'fi', 'fl': 'fl', 'st': 'st', "⁰": "0", "¹": "1", "²": "2", "³": "3", "⁴": "4", "⁵": "5", "⁶": "6", "⁷": "7", "⁸": "8", "⁹": "9", "₀": "0", "₁": "1", "₂": "2", "₃": "3", "₄": "4", "₅": "5", "₆": "6", "₇": "7", "₈": "8", "₉": "9", @@ -51,11 +51,11 @@ sWord = sWord.lower().translate(_xTransCharsForSimplification) sNewWord = "" for i, c in enumerate(sWord, 1): if c != sWord[i:i+1] or (c == 'e' and sWord[i:i+2] != "ee"): # exception for to avoid confusion between crée / créai sNewWord += c - return sNewWord.replace("eau", "o").replace("au", "o").replace("ai", "éi").replace("ei", "é").replace("ph", "f") + return sNewWord.replace("eau", "o").replace("au", "o").replace("ei", "e").replace("ai", "ei").replace("ph", "f") def cleanWord (sWord): "remove letters repeated more than 2 times" return re.sub("(.)\\1{2,}", '\\1\\1', sWord)