Overview
| Comment: | [core] reduce number of hard replacements (avoid slowness) |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | core |
| Files: | files | file ages | folders |
| SHA3-256: |
0114e69bdb54b7044ed344d3c8dcd1f4 |
| User & Date: | olr on 2017-10-22 09:17:02 |
| Other Links: | manifest | tags |
Context
|
2017-10-22
| ||
| 09:20 | [core][py] endswith can take a tuple as parameter check-in: f74d435789 user: olr tags: trunk, core | |
| 09:17 | [core] reduce number of hard replacements (avoid slowness) check-in: 0114e69bdb user: olr tags: trunk, core | |
| 09:15 | [core][py] small code cleaning check-in: d78ef84a02 user: olr tags: trunk, core | |
Changes
Modified gc_core/js/ibdawg.js from [6ddb36891f] to [987b525ef9].
| ︙ | ︙ | |||
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) / 3), 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 [465d7a71d5] to [d3b377616f].
| ︙ | ︙ | |||
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) // 3, 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:
|
| ︙ | ︙ |