Overview
| Comment: | [core] ibdawg: add suggestions by switching chars | 
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive | 
| Timelines: | family | ancestors | descendants | both | trunk | core | 
| Files: | files | file ages | folders | 
| SHA3-256: | 284a6fae4c9bf5ddef4e237dd8d0c9ca | 
| User & Date: | olr on 2017-07-06 14:33:28 | 
| Other Links: | manifest | tags | 
Context
| 2017-07-07 | ||
| 09:28 | [core][bug] spellchecker: import check-in: 893f14b8f3 user: olr tags: trunk, core | |
| 2017-07-06 | ||
| 14:33 | [core] ibdawg: add suggestions by switching chars check-in: 284a6fae4c user: olr tags: trunk, core | |
| 14:31 | [fr] phonet_simil: <affect/affecte> check-in: 8ff76fb1e0 user: olr tags: trunk, fr | |
Changes
Modified gc_core/py/ibdawg.py from [750537b4f6] to [9237f7174c].
| ︙ | ︙ | |||
| 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | 
            #show(nDeep, cChar)
            aSugg.update(self._suggest(sRemain[1:], nDeep+1, jAddr, sNewWord+cChar))
        if not bAvoidLoop: # avoid infinite loop
            #show(nDeep, ":no loop:")
            if cCurrent == sRemain[1:2]:
                # same char, we remove 1 char without adding 1 to <sNewWord>
                aSugg.update(self._suggest(sRemain[1:], nDeep+1, iAddr, sNewWord))
            for sRepl in cp.d1toX.get(cCurrent, ()):
                #show(nDeep, sRepl)
                aSugg.update(self._suggest(sRepl + sRemain[1:], nDeep+1, iAddr, sNewWord, True))
            for sRepl in cp.d2toX.get(sRemain[0:2], ()):
                #show(nDeep, sRepl)
                aSugg.update(self._suggest(sRepl + sRemain[2:], nDeep+1, iAddr, sNewWord, True))
            if len(sRemain) == 2:
 | > > > | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | 
            #show(nDeep, cChar)
            aSugg.update(self._suggest(sRemain[1:], nDeep+1, jAddr, sNewWord+cChar))
        if not bAvoidLoop: # avoid infinite loop
            #show(nDeep, ":no loop:")
            if cCurrent == sRemain[1:2]:
                # same char, we remove 1 char without adding 1 to <sNewWord>
                aSugg.update(self._suggest(sRemain[1:], nDeep+1, iAddr, sNewWord))
            else:
                # switching chars
                aSugg.update(self._suggest(sRemain[1:2]+sRemain[0:1]+sRemain[2:], nDeep+1, iAddr, sNewWord, True))
            for sRepl in cp.d1toX.get(cCurrent, ()):
                #show(nDeep, sRepl)
                aSugg.update(self._suggest(sRepl + sRemain[1:], nDeep+1, iAddr, sNewWord, True))
            for sRepl in cp.d2toX.get(sRemain[0:2], ()):
                #show(nDeep, sRepl)
                aSugg.update(self._suggest(sRepl + sRemain[2:], nDeep+1, iAddr, sNewWord, True))
            if len(sRemain) == 2:
 | 
| ︙ | ︙ |