Index: gc_lang/fr/modules/tests_modules.py ================================================================== --- gc_lang/fr/modules/tests_modules.py +++ gc_lang/fr/modules/tests_modules.py @@ -58,15 +58,15 @@ for sWord in [ "déelirranttesss", "vallidasion", "Emilie", "exibission", "ditirembique", "jai", "email", "fatiqué", "coeur", "trèèèèèèèèès", "vraaaaiiiimeeeeennnt", "apele", "Co2", "emmppâiiiller", "testt", "apelaion", "exsepttion", "sintaxik", "ebriete", "ennormmement" ]: - for lSugg in self.oSpellChecker.suggest(sWord): - self.assertTrue(len(lSugg) > 0) #with timeblock(sWord): - # aSugg = self.oSpellChecker.suggest(sWord) - # print(sWord, "->", " ".join(aSugg)) + for lSugg in self.oSpellChecker.suggest(sWord): + #print(sWord, "->", " ".join(lSugg)) + self.assertTrue(len(lSugg) > 0) + def test_lemmas (self): for sWord, sInfi in [ ("suis", "suivre"), ("suis", "être"), Index: graphspell-js/ibdawg.js ================================================================== --- graphspell-js/ibdawg.js +++ graphspell-js/ibdawg.js @@ -45,10 +45,13 @@ } this.aAllSugg.add(sSugg); // jaro 0->1 1 les chaines sont égale let nDistJaro = 1 - str_transform.distanceJaroWinkler(this.sSimplifiedWord, str_transform.simplifyWord(sSugg)); let nDist = Math.floor(nDistJaro * 10); + if (nDist < this.nMinDist) { + this.nMinDist = nDist; + } if (nDistJaro < .11) { // Best suggestions this.dBestSugg.set(sSugg, Math.round(nDistJaro*1000)); if (this.dBestSugg.size > this.nBestSuggLimit) { this.nDistLimit = -1; // make suggest() to end search } @@ -55,22 +58,12 @@ } else if (nDistJaro < .33) { // Good suggestions this.dGoodSugg.set(sSugg, Math.round(nDistJaro*1000)); if (this.dGoodSugg.size > this.nGoodSuggLimit) { this.nDistLimit = -1; // make suggest() to end search } - } else { - if (nDist < this.nMinDist) { - this.nMinDist = nDist; - } - this.nDistLimit = Math.min(this.nDistLimit, this.nMinDist); - } - if (nDist <= this.nDistLimit) { - if (nDist < this.nMinDist) { - this.nMinDist = nDist; - } - this.nDistLimit = Math.min(this.nDistLimit, this.nMinDist+1); - } + } + this.nDistLimit = Math.min(this.nDistLimit, this.nMinDist+1); } getSuggestions () { // return a list of suggestions let lRes = []; @@ -342,10 +335,11 @@ sWord = str_transform.cleanWord(sWord); if (bSplitTrailingNumbers) { this._splitTrailingNumbers(oSuggResult, sWord); } this._splitSuggest(oSuggResult, sWord); + this._suggest(oSuggResult, sWord); this._suggest(oSuggResult, sWord, nMaxSwitch, nMaxDel, nMaxHardRepl, nMaxJump); let aSugg = oSuggResult.getSuggestions(); if (this.lexicographer) { aSugg = this.lexicographer.filterSugg(aSugg); } Index: graphspell/ibdawg.py ================================================================== --- graphspell/ibdawg.py +++ graphspell/ibdawg.py @@ -61,27 +61,22 @@ if sSugg in self.aAllSugg: return self.aAllSugg.add(sSugg) nDistJaro = 1 - st.distanceJaroWinkler(self.sSimplifiedWord, st.simplifyWord(sSugg)) nDist = floor(nDistJaro * 10) + if nDist < self.nMinDist: + self.nMinDist = nDist #logging.info((nDeep * " ") + "__" + sSugg + "__ " + str(round(nDistJaro*1000))) if nDistJaro < .11: # Best suggestions self.dBestSugg[sSugg] = round(nDistJaro*1000) if len(self.dBestSugg) > self.nBestSuggLimit: self.nDistLimit = -1 # make suggest() to end search elif nDistJaro < .33: # Good suggestions self.dGoodSugg[sSugg] = round(nDistJaro*1000) if len(self.dGoodSugg) > self.nGoodSuggLimit: self.nDistLimit = -1 # make suggest() to end search - else: - if nDist < self.nMinDist: - self.nMinDist = nDist - self.nDistLimit = min(self.nDistLimit, self.nMinDist) - if nDist <= self.nDistLimit: - if nDist < self.nMinDist: - self.nMinDist = nDist - self.nDistLimit = min(self.nDistLimit, self.nMinDist+1) + self.nDistLimit = min(self.nDistLimit, self.nMinDist+1) def getSuggestions (self): "return a list of suggestions" # we sort the better results with the original word lRes = [] @@ -244,10 +239,11 @@ oSuggResult = SuggResult(sWord, nSuggLimit) sWord = st.cleanWord(sWord) if bSplitTrailingNumbers: self._splitTrailingNumbers(oSuggResult, sWord) self._splitSuggest(oSuggResult, sWord) + self._suggest(oSuggResult, sWord) self._suggest(oSuggResult, sWord, nMaxSwitch, nMaxDel, nMaxHardRepl, nMaxJump) aSugg = oSuggResult.getSuggestions() if self.lexicographer: aSugg = self.lexicographer.filterSugg(aSugg) if sSfx or sPfx: