Grammalecte  Check-in [5c78444baa]

Overview
Comment:[core] ibdawg: suggest > DamerauLevenshtein seems better than Sift4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | spellsugg
Files: files | file ages | folders
SHA3-256: 5c78444baa85907d87855a352924beb9be9c5f11f69ea5e221d42e0cf071571b
User & Date: olr on 2017-11-07 17:39:13
Other Links: branch diff | manifest | tags
Context
2017-11-07
17:59
[core] ibdawg: use SuggResult for the first suggestion method also check-in: 515e7f3768 user: olr tags: core, spellsugg
17:39
[core] ibdawg: suggest > DamerauLevenshtein seems better than Sift4 check-in: 5c78444baa user: olr tags: core, spellsugg
17:03
[core] ibdawg: use SuggResult object + code cleaning check-in: 6c8c1776f5 user: olr tags: core, spellsugg
Changes

Modified gc_core/py/ibdawg.py from [6eb071b95f] to [40cad773c0].

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
        self.nMaxDist = 0
        self.aSugg = set()
        self.dSugg = { 0: [],  1: [],  2: [] }

    def addSugg (self, sSugg, nDeep=0):
        "add a suggestion"
        if sSugg not in self.aSugg:
            nDist = st.distanceSift4(self.sCleanWord, cp.cleanWord(sSugg))
            if nDist <= self.nDistLimit:
                if nDist not in self.dSugg:
                    self.dSugg[nDist] = []
                self.dSugg[nDist].append(sSugg)
                logging.info((nDeep * "  ") + "__" + sSugg + "__")
                if nDist > self.nMaxDist:
                    self.nMaxDist = nDist







|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
        self.nMaxDist = 0
        self.aSugg = set()
        self.dSugg = { 0: [],  1: [],  2: [] }

    def addSugg (self, sSugg, nDeep=0):
        "add a suggestion"
        if sSugg not in self.aSugg:
            nDist = st.distanceDamerauLevenshtein(self.sCleanWord, cp.cleanWord(sSugg))
            if nDist <= self.nDistLimit:
                if nDist not in self.dSugg:
                    self.dSugg[nDist] = []
                self.dSugg[nDist].append(sSugg)
                logging.info((nDeep * "  ") + "__" + sSugg + "__")
                if nDist > self.nMaxDist:
                    self.nMaxDist = nDist