Grammalecte  Diff

Differences From Artifact [abe9c98a1b]:

To Artifact [d23b81aee3]:


43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
        this.aAllSugg.add(sSugg);
        //console.log("Grammalecte: " + sSugg);
        let nSimDist = str_transform.distanceSift4(this.sSimplifiedWord, str_transform.simplifyWord(sSugg));
        if (nSimDist < this.nMinDist) {
            this.nMinDist = nSimDist;
        }
        if (nSimDist <= this.nMinDist+1) {
            let nDist = Math.min(str_transform.distanceDamerauLevenshtein(this.sWord, sSugg), str_transform.distanceDamerauLevenshtein(this.sSimplifiedWord, str_transform.simplifyWord(sSugg)));

            this.dAccSugg.set(sSugg, Math.min(nDist, nSimDist+1));
            if (this.dAccSugg.size  > this.nTempSuggLimit) {
                this.nDistLimit = -1; // suggest() ends searching when this variable = -1
            }
        }
        this.nDistLimit = Math.min(this.nDistLimit, this.nMinDist+1);
        //console.log(this.dAccSugg);
    }







|
>
|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
        this.aAllSugg.add(sSugg);
        //console.log("Grammalecte: " + sSugg);
        let nSimDist = str_transform.distanceSift4(this.sSimplifiedWord, str_transform.simplifyWord(sSugg));
        if (nSimDist < this.nMinDist) {
            this.nMinDist = nSimDist;
        }
        if (nSimDist <= this.nMinDist+1) {
            let nDist = Math.min(str_transform.distanceDamerauLevenshteinX(this.sWord, sSugg), str_transform.distanceDamerauLevenshteinX(this.sSimplifiedWord, str_transform.simplifyWord(sSugg)));
            if (sSugg.includes(" ")) { nDist += 1; }
            this.dAccSugg.set(sSugg, nDist);
            if (this.dAccSugg.size  > this.nTempSuggLimit) {
                this.nDistLimit = -1; // suggest() ends searching when this variable = -1
            }
        }
        this.nDistLimit = Math.min(this.nDistLimit, this.nMinDist+1);
        //console.log(this.dAccSugg);
    }