Grammalecte  Check-in [369e43f830]

Overview
Comment:[graphspell] suggestion mechanism: preserve capital letters (don’t use istitle/titlecase automation)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 369e43f830fb70975716522e636111ca7ccb5df4530fe3679f2ae10ecfd1ff6b
User & Date: olr on 2018-04-18 10:05:14
Original Comment: [graphspell] suggest mechanism: preserve capital letters (don’t use istitle/titlecase automation)
Other Links: manifest | tags
Context
2018-04-18
10:06
[graphspell][js] coding style: spaces cleaning check-in: 009a55b028 user: olr tags: trunk, graphspell
10:05
[graphspell] suggestion mechanism: preserve capital letters (don’t use istitle/titlecase automation) check-in: 369e43f830 user: olr tags: trunk, graphspell
2018-04-17
11:17
[fr][bug] Mauvaises suggestions avec les majuscule accentuées check-in: cdf7ae7cd5 user: olr tags: trunk, fr
Changes

Modified graphspell-js/ibdawg.js from [ee32a83c3f] to [bd1655e79d].

66
67
68
69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
        for (let lSugg of this.dSugg.values()) {
            for (let sSugg of lSugg) { lRes.push(sSugg); }
            if (lRes.length > nSuggLimit) {
                break;
            }
        }
        lRes = char_player.filterSugg(lRes);
        if (this.sWord.gl_isTitle()) {
            lRes = lRes.map((sSugg) => { return sSugg.gl_toCapitalize(); });
        }
        else if (this.sWord.gl_isUpperCase()) {
            lRes = lRes.map((sSugg) => { return sSugg.toUpperCase(); });
        }

        return lRes.slice(0, nSuggLimit);
    }

    reset () {
        this.aSugg.clear();
        this.dSugg.clear();
    }







|
|

|
|

>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
        for (let lSugg of this.dSugg.values()) {
            for (let sSugg of lSugg) { lRes.push(sSugg); }
            if (lRes.length > nSuggLimit) {
                break;
            }
        }
        lRes = char_player.filterSugg(lRes);
        if (this.sWord.gl_isUpperCase()) {
            lRes = lRes.map((sSugg) => { return sSugg.toUpperCase(); });
        }
        else if (this.sWord.slice(0,1).gl_isUpperCase()) {
            lRes = lRes.map((sSugg) => { return sSugg.slice(0, 1).toUpperCase() + sSugg.slice(1); });
        }
        
        return lRes.slice(0, nSuggLimit);
    }

    reset () {
        this.aSugg.clear();
        this.dSugg.clear();
    }

Modified graphspell/ibdawg.py from [cffe6cd67c] to [eaec2d5a8e].

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
            # we sort the better results with the original word
            self.dSugg[0].sort(key=lambda sSugg: st.distanceDamerauLevenshtein(self.sWord, sSugg))
        for lSugg in self.dSugg.values():
            lRes.extend(lSugg)
            if len(lRes) > nSuggLimit:
                break
        lRes = list(cp.filterSugg(lRes))
        if self.sWord.istitle():
            lRes = list(map(lambda sSugg: sSugg.title(), lRes))
        elif self.sWord.isupper():
            lRes = list(map(lambda sSugg: sSugg.upper(), lRes))
        return lRes[:nSuggLimit]

    def reset (self):
        self.aSugg.clear()
        self.dSugg.clear()









|
|
|
|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
            # we sort the better results with the original word
            self.dSugg[0].sort(key=lambda sSugg: st.distanceDamerauLevenshtein(self.sWord, sSugg))
        for lSugg in self.dSugg.values():
            lRes.extend(lSugg)
            if len(lRes) > nSuggLimit:
                break
        lRes = list(cp.filterSugg(lRes))
        if self.sWord.isupper():
            lRes = list(map(lambda sSugg: sSugg.upper(), lRes))
        elif self.sWord[0:1].isupper():
            lRes = list(map(lambda sSugg: sSugg[0:1].upper()+sSugg[1:], lRes))  # dont’ use <.istitle>
        return lRes[:nSuggLimit]

    def reset (self):
        self.aSugg.clear()
        self.dSugg.clear()