Grammalecte  Check-in [0eaff45865]

Overview
Comment:[graphspell][py][bug] fix words selection
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 0eaff45865f7e2db3f720e825c8560b3f6ab80e0860352246399e36c649c5760
User & Date: olr on 2018-05-03 11:33:54
Other Links: manifest | tags
Context
2018-05-04
08:16
[graphspell][py] dawg builder: filter entries with regex check-in: 96692bb883 user: olr tags: trunk, graphspell
2018-05-03
11:33
[graphspell][py][bug] fix words selection check-in: 0eaff45865 user: olr tags: trunk, graphspell
2018-05-02
18:01
[core][fx][tb][lo][fr] formateur de texte: autres titres de civilité check-in: a947543048 user: olr tags: trunk, fr, core, tb, fx, lo
Changes

Modified graphspell/ibdawg.py from [c974bfe0f8] to [2f2c00b856].

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    def getSuggestions (self, nSuggLimit=10, nDistLimit=-1):
        "return a list of suggestions"
        if self.dSugg[0]:
            # we sort the better results with the original word
            self.dSugg[0].sort(key=lambda sSugg: st.distanceDamerauLevenshtein(self.sWord, sSugg))
        lRes = self.dSugg.pop(0)
        for nDist, lSugg in self.dSugg.items():
            if nDist >= self.nDistLimit:
                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():







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    def getSuggestions (self, nSuggLimit=10, nDistLimit=-1):
        "return a list of suggestions"
        if self.dSugg[0]:
            # we sort the better results with the original word
            self.dSugg[0].sort(key=lambda sSugg: st.distanceDamerauLevenshtein(self.sWord, sSugg))
        lRes = self.dSugg.pop(0)
        for nDist, lSugg in self.dSugg.items():
            if nDist <= self.nDistLimit:
                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():