Grammalecte  Check-in [726af0786e]

Overview
Comment:[core] ibdawg: remove comments
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core | v0.6.0
Files: files | file ages | folders
SHA3-256: 726af0786e831cb6e53bf3d013faf8e7e135b394b333d8a67e1dc9fce20fbf01
User & Date: olr on 2017-10-21 17:55:39
Other Links: manifest | tags
Context
2017-10-22
08:26
[core][py] ibdawg: spellchecking suggestion mechanism > hard replacements check-in: 9fde57a772 user: olr tags: trunk, core
2017-10-21
17:55
[core] ibdawg: remove comments check-in: 726af0786e user: olr tags: trunk, core, v0.6.0
11:03
[fx] close button for the menu check-in: 4ff89b5e43 user: olr tags: trunk, fx
Changes

Modified gc_core/py/ibdawg.py from [e68f28dc22] to [88ac62fcd4].

264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
                    aTails.update(self._getTails(jAddr, sTail+self.dCharVal[nVal], n-1))
        return aTails

    def _suggestWithCrushedUselessChars (self, sWord, nDeep=0, iAddr=0, sNewWord="", bAvoidLoop=False):
        aSugg = set()
        if not sWord:
            if int.from_bytes(self.byDic[iAddr:iAddr+self.nBytesArc], byteorder='big') & self._finalNodeMask:
                show(nDeep, "!!! " + sNewWord + " !!!")
                aSugg.add(sNewWord)
            return aSugg
        cCurrent = sWord[0:1]
        for cChar, jAddr in self._getSimilarArcsAndCrushedChars(cCurrent, iAddr):
            show(nDeep, cChar)
            aSugg.update(self._suggestWithCrushedUselessChars(sWord[1:], nDeep+1, jAddr, sNewWord+cChar))
        return aSugg

    def _getSimilarArcsAndCrushedChars (self, cChar, iAddr):
        "generator: yield similar char of <cChar> and address of the following node"
        for nVal, jAddr in self._getArcs(iAddr):
            if self.dCharVal.get(nVal, None) in cp.aVovels:







|




|







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
                    aTails.update(self._getTails(jAddr, sTail+self.dCharVal[nVal], n-1))
        return aTails

    def _suggestWithCrushedUselessChars (self, sWord, nDeep=0, iAddr=0, sNewWord="", bAvoidLoop=False):
        aSugg = set()
        if not sWord:
            if int.from_bytes(self.byDic[iAddr:iAddr+self.nBytesArc], byteorder='big') & self._finalNodeMask:
                #show(nDeep, "!!! " + sNewWord + " !!!")
                aSugg.add(sNewWord)
            return aSugg
        cCurrent = sWord[0:1]
        for cChar, jAddr in self._getSimilarArcsAndCrushedChars(cCurrent, iAddr):
            #show(nDeep, cChar)
            aSugg.update(self._suggestWithCrushedUselessChars(sWord[1:], nDeep+1, jAddr, sNewWord+cChar))
        return aSugg

    def _getSimilarArcsAndCrushedChars (self, cChar, iAddr):
        "generator: yield similar char of <cChar> and address of the following node"
        for nVal, jAddr in self._getArcs(iAddr):
            if self.dCharVal.get(nVal, None) in cp.aVovels: