Grammalecte  Check-in [7e24b83b14]

Overview
Comment:[graphspell] ad hoc suggestions with full uppercase words
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 7e24b83b14f70603f0250444ed27d6d0a4efde066e43f6ff52f077844357e785
User & Date: olr on 2025-09-13 13:25:30
Other Links: manifest | tags
Context
2025-09-13
13:25
[graphspell] ad hoc suggestions with full uppercase words Leaf check-in: 7e24b83b14 user: olr tags: trunk, graphspell
12:37
[graphspell] use echo() instead of print(), because printing on Windows still sucks check-in: ffb80ebf4d user: olr tags: trunk, graphspell
Changes

Modified gc_lang/fr/modules/tests_modules.py from [5dcbe6a7fd] to [20f3337db3].

67
68
69
70
71
72
73

74
75
76
77
78
79
80
            ("email", "courriel"),
            ("fatiqué", "fatigué"),
            ("coeur", "cœur"),
            ("trèèèèèèèèès", "très"),
            ("vraaaaiiiimeeeeennnt", "vraiment"),
            ("oeil", "œil"),
            ("Oeil", "Œil"),

            ("apele", "appel"),
            ("Co2", "CO₂"),
            ("emmppâiiiller", "empailler"),
            ("testt", "test"),
            ("apelaion", "appellation"),
            ("exsepttion", "exception"),
            ("sintaxik", "syntaxique"),







>







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
            ("email", "courriel"),
            ("fatiqué", "fatigué"),
            ("coeur", "cœur"),
            ("trèèèèèèèèès", "très"),
            ("vraaaaiiiimeeeeennnt", "vraiment"),
            ("oeil", "œil"),
            ("Oeil", "Œil"),
            ("OEIL", "ŒIL"),
            ("apele", "appel"),
            ("Co2", "CO₂"),
            ("emmppâiiiller", "empailler"),
            ("testt", "test"),
            ("apelaion", "appellation"),
            ("exsepttion", "exception"),
            ("sintaxik", "syntaxique"),

Modified graphspell-js/spellchecker.js from [299826c38f] to [088e14f90c].

329
330
331
332
333
334
335



336
337
338
339
340
341
342
        // generator: returns 1, 2 or 3 lists of suggestions
        if (this.lexicographer) {
            if (this.lexicographer.dSugg.has(sWord)) {
                yield this.lexicographer.dSugg.get(sWord).split("|");
            } else if (sWord.gl_isTitle() && this.lexicographer.dSugg.has(sWord.toLowerCase())) {
                let lSuggs = this.lexicographer.dSugg.get(sWord.toLowerCase()).split("|");
                yield lSuggs.map((sSugg) => { return sSugg.slice(0,1).toUpperCase() + sSugg.slice(1); });



            } else {
                let lSuggs = this.oMainDic.suggest(sWord, nSuggLimit, true);
                lSuggs = lSuggs.filter((sSugg) => this.lexicographer.isValidSugg(sSugg, this));
                yield lSuggs;
            }
        } else {
            yield this.oMainDic.suggest(sWord, nSuggLimit, true);







>
>
>







329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
        // generator: returns 1, 2 or 3 lists of suggestions
        if (this.lexicographer) {
            if (this.lexicographer.dSugg.has(sWord)) {
                yield this.lexicographer.dSugg.get(sWord).split("|");
            } else if (sWord.gl_isTitle() && this.lexicographer.dSugg.has(sWord.toLowerCase())) {
                let lSuggs = this.lexicographer.dSugg.get(sWord.toLowerCase()).split("|");
                yield lSuggs.map((sSugg) => { return sSugg.slice(0,1).toUpperCase() + sSugg.slice(1); });
            } else if (sWord.gl_isUpperCase() && this.lexicographer.dSugg.has(sWord.toLowerCase())) {
                let lSuggs = this.lexicographer.dSugg.get(sWord.toLowerCase()).split("|");
                yield lSuggs.map((sSugg) => { return sSugg.toUpperCase(); });
            } else {
                let lSuggs = this.oMainDic.suggest(sWord, nSuggLimit, true);
                lSuggs = lSuggs.filter((sSugg) => this.lexicographer.isValidSugg(sSugg, this));
                yield lSuggs;
            }
        } else {
            yield this.oMainDic.suggest(sWord, nSuggLimit, true);

Modified graphspell/spellchecker.py from [8c24055087] to [3d4ab04b0c].

287
288
289
290
291
292
293



294
295
296
297
298
299
300
        "generator: returns 1, 2 or 3 lists of suggestions"
        if self.lexicographer:
            if sWord in self.lexicographer.dSugg:
                yield self.lexicographer.dSugg[sWord].split("|")
            elif sWord.istitle() and sWord.lower() in self.lexicographer.dSugg:
                lSuggs = self.lexicographer.dSugg[sWord.lower()].split("|")
                yield list(map(lambda sSugg: sSugg[0:1].upper()+sSugg[1:], lSuggs))



            else:
                lSuggs = self.oMainDic.suggest(sWord, nSuggLimit, True)
                lSuggs = [ sSugg  for sSugg in lSuggs  if self.lexicographer.isValidSugg(sSugg, self) ]
                yield lSuggs
        else:
            yield self.oMainDic.suggest(sWord, nSuggLimit, True)
        if self.bCommunityDic:







>
>
>







287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
        "generator: returns 1, 2 or 3 lists of suggestions"
        if self.lexicographer:
            if sWord in self.lexicographer.dSugg:
                yield self.lexicographer.dSugg[sWord].split("|")
            elif sWord.istitle() and sWord.lower() in self.lexicographer.dSugg:
                lSuggs = self.lexicographer.dSugg[sWord.lower()].split("|")
                yield list(map(lambda sSugg: sSugg[0:1].upper()+sSugg[1:], lSuggs))
            elif sWord.isupper() and sWord.lower() in self.lexicographer.dSugg:
                lSuggs = self.lexicographer.dSugg[sWord.lower()].split("|")
                yield list(map(lambda sSugg: sSugg.upper(), lSuggs))
            else:
                lSuggs = self.oMainDic.suggest(sWord, nSuggLimit, True)
                lSuggs = [ sSugg  for sSugg in lSuggs  if self.lexicographer.isValidSugg(sSugg, self) ]
                yield lSuggs
        else:
            yield self.oMainDic.suggest(sWord, nSuggLimit, True)
        if self.bCommunityDic: