Overview
Comment: | [core] ibdawg: reduce hard replacements in suggestion mechanism |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | core |
Files: | files | file ages | folders |
SHA3-256: |
35abf9fb76e716d1f5aacbf3394a3319 |
User & Date: | olr on 2017-10-24 12:05:31 |
Other Links: | manifest | tags |
Context
2017-10-24
| ||
22:24 | [core] ibdawg: suggestion mechanism > exclude some suffixes (ß) check-in: 5fbb7ec853 user: olr tags: trunk, core | |
12:05 | [core] ibdawg: reduce hard replacements in suggestion mechanism check-in: 35abf9fb76 user: olr tags: trunk, core | |
11:59 | [core] fix tokentizer: two similar group name in regex check-in: 78199c4006 user: olr tags: trunk, core | |
Changes
Modified gc_core/js/ibdawg.js from [987b525ef9] to [330301cb59].
︙ | ︙ | |||
187 188 189 190 191 192 193 | } return l; } suggest (sWord, nMaxSugg=10) { // returns a array of suggestions for <sWord> let nMaxDel = Math.floor(sWord.length / 5); | | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | } return l; } suggest (sWord, nMaxSugg=10) { // returns a array of suggestions for <sWord> let nMaxDel = Math.floor(sWord.length / 5); let nMaxHardRepl = Math.max(Math.floor((sWord.length - 5) / 4), 1); let aSugg = this._suggest(sWord, nMaxDel, nMaxHardRepl); if (sWord.gl_isTitle()) { aSugg.gl_update(this._suggest(sWord.toLowerCase(), nMaxDel, nMaxHardRepl)); } else if (sWord.gl_isLowerCase()) { aSugg.gl_update(this._suggest(sWord.gl_toCapitalize(), nMaxDel, nMaxHardRepl)); } |
︙ | ︙ |
Modified gc_core/py/ibdawg.py from [bb15f40868] to [d3aa940937].
︙ | ︙ | |||
187 188 189 190 191 192 193 | l.extend(self.morph(sWord.capitalize())) return l def suggest (self, sWord, nMaxSugg=10): "returns a set of suggestions for <sWord>" aSugg = set() nMaxDel = len(sWord) // 5 | | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | l.extend(self.morph(sWord.capitalize())) return l def suggest (self, sWord, nMaxSugg=10): "returns a set of suggestions for <sWord>" aSugg = set() nMaxDel = len(sWord) // 5 nMaxHardRepl = max((len(sWord) - 5) // 4, 1) aSugg.update(self._suggest(sWord, nMaxDel=nMaxDel, nMaxHardRepl=nMaxHardRepl)) if sWord.istitle(): aSugg.update(self._suggest(sWord.lower(), nMaxDel=nMaxDel, nMaxHardRepl=nMaxHardRepl)) aSugg = set(map(lambda sSugg: sSugg.title(), aSugg)) elif sWord.islower(): aSugg.update(self._suggest(sWord.title(), nMaxDel=nMaxDel, nMaxHardRepl=nMaxHardRepl)) if not aSugg: |
︙ | ︙ |