Grammalecte  Diff

Differences From Artifact [250621182e]:

To Artifact [544f660d8a]:


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

70
71
72




73
74
75
76
77
78
79
                this.nDistLimit = Math.min(this.nDistLimit, this.nMinDist+1);
            }
        }
    }

    getSuggestions (nSuggLimit=10) {
        // return a list of suggestions
        if (this.dSugg.get(0).length > 1) {
            // we sort the better results with the original word
            this.dSugg.get(0).sort((a, b) => { return str_transform.distanceDamerauLevenshtein(this.sWord, a) - str_transform.distanceDamerauLevenshtein(this.sWord, b); });
        }
        else if (this.dSugg.get(1).length > 1) {
            this.dSugg.get(1).sort((a, b) => { return str_transform.distanceDamerauLevenshtein(this.sWord, a) - str_transform.distanceDamerauLevenshtein(this.sWord, b); });
        }
        let lRes = [];

        for (let [nDist, lSugg] of this.dSugg.entries()) {
            if (nDist > this.nDistLimit) {
                break;




            }
            lRes.push(...lSugg);
            if (lRes.length > nSuggLimit) {
                break;
            }
        }
        if (this.sWord.gl_isUpperCase()) {







<
<
<
<
<
<
<

>



>
>
>
>







55
56
57
58
59
60
61







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
                this.nDistLimit = Math.min(this.nDistLimit, this.nMinDist+1);
            }
        }
    }

    getSuggestions (nSuggLimit=10) {
        // return a list of suggestions







        let lRes = [];
        let bFirstListSorted = false;
        for (let [nDist, lSugg] of this.dSugg.entries()) {
            if (nDist > this.nDistLimit) {
                break;
            }
            if (!bFirstListSorted && lSugg.length > 1) {
                lRes.sort((a, b) => { return str_transform.distanceDamerauLevenshtein(this.sWord, a) - str_transform.distanceDamerauLevenshtein(this.sWord, b); });
                bFirstListSorted = true;
            }
            lRes.push(...lSugg);
            if (lRes.length > nSuggLimit) {
                break;
            }
        }
        if (this.sWord.gl_isUpperCase()) {