Grammalecte  Check-in [a00365529c]

Overview
Comment:[graphspell] add 1 to distance between word and suggestion if word is split
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: a00365529c81e984616626e6c0840424422ab99d3fc584a17f7df29d61c4ed1a
User & Date: olr on 2020-04-14 15:26:59
Other Links: manifest | tags
Context
2020-04-14
16:29
[graphspell] suggestion: word simplification -> don’t replace e with diacritics by e, but by é check-in: e3abe93f37 user: olr tags: trunk, graphspell
15:26
[graphspell] add 1 to distance between word and suggestion if word is split check-in: a00365529c user: olr tags: trunk, graphspell
13:29
[fx] restart connection to background when it’s lost check-in: d5c7fd1677 user: olr tags: trunk, fx
Changes

Modified graphspell-js/ibdawg.js from [b87d78e936] to [9b51ad972c].

40
41
42
43
44
45
46



47
48
49
50
51
52
53
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56







+
+
+







        if (this.aAllSugg.has(sSugg)) {
            return;
        }
        this.aAllSugg.add(sSugg);
        if (!this.aSugg.has(sSugg)) {
            let nDist = str_transform.distanceDamerauLevenshtein(this.sSimplifiedWord, char_player.simplifyWord(sSugg));
            if (nDist <= this.nDistLimit) {
                if (sSugg.includes(" ")) { // add 1 to distance for split suggestions
                    nDist += 1;
                }
                if (!this.dSugg.has(nDist)) {
                    this.dSugg.set(nDist, []);
                }
                this.dSugg.get(nDist).push(sSugg);
                this.aSugg.add(sSugg);
                if (nDist < this.nMinDist) {
                    this.nMinDist = nDist;

Modified graphspell/ibdawg.py from [34d4e4f42a] to [3cc04ec719].

53
54
55
56
57
58
59


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







+
+







        #logging.info((nDeep * "  ") + "__" + sSugg + "__")
        if sSugg in self.aAllSugg:
            return
        self.aAllSugg.add(sSugg)
        if sSugg not in self.aSugg:
            nDist = st.distanceDamerauLevenshtein(self.sSimplifiedWord, cp.simplifyWord(sSugg))
            if nDist <= self.nDistLimit:
                if " " in sSugg:
                    nDist += 1
                if nDist not in self.dSugg:
                    self.dSugg[nDist] = []
                self.dSugg[nDist].append(sSugg)
                self.aSugg.add(sSugg)
                if nDist < self.nMinDist:
                    self.nMinDist = nDist
                self.nDistLimit = min(self.nDistLimit, self.nMinDist+1)