Overview
Comment: | [graphspell] suggestions speed up |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | graphspell |
Files: | files | file ages | folders |
SHA3-256: |
d420766661562536a6e415d78dd72a8e |
User & Date: | olr on 2018-04-06 21:28:21 |
Other Links: | manifest | tags |
Context
2018-04-07
| ||
11:05 | [graphspell] suggestions speed up (memorize state) check-in: b7d3d7f5ba user: olr tags: trunk, graphspell | |
2018-04-06
| ||
21:28 | [graphspell] suggestions speed up check-in: d420766661 user: olr tags: trunk, graphspell | |
21:02 | [graphspell] char_player update check-in: d938e081a3 user: olr tags: trunk, graphspell | |
Changes
Modified graphspell-js/ibdawg.js from [1351b5e397] to [cc24c04950].
︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | + + + + + | constructor (sWord, nDistLimit=-1) { this.sWord = sWord; this.sSimplifiedWord = char_player.simplifyWord(sWord); this.nDistLimit = (nDistLimit >= 0) ? nDistLimit : Math.floor(sWord.length / 3) + 1; this.nMinDist = 1000; this.aSugg = new Set(); this.dSugg = new Map([ [0, []], [1, []], [2, []] ]); this.aAllSugg = new Set(); // all found words even those refused } addSugg (sSugg, nDeep=0) { // add a suggestion if (this.aAllSugg.has(sSugg)) { return; } this.aAllSugg.add(sSugg); if (!this.aSugg.has(sSugg)) { let nDist = str_transform.distanceDamerauLevenshtein(this.sSimplifiedWord, char_player.simplifyWord(sSugg)); if (nDist <= this.nDistLimit) { if (!this.dSugg.has(nDist)) { this.dSugg.set(nDist, []); } this.dSugg.get(nDist).push(sSugg); |
︙ |
Modified graphspell/ibdawg.py from [9dd4726d13] to [e811d4895f].
︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | + + + + | def __init__ (self, sWord, nDistLimit=-1): self.sWord = sWord self.sSimplifiedWord = cp.simplifyWord(sWord) self.nDistLimit = nDistLimit if nDistLimit >= 0 else (len(sWord) // 3) + 1 self.nMinDist = 1000 self.aSugg = set() self.dSugg = { 0: [], 1: [], 2: [] } self.aAllSugg = set() # all found words even those refused def addSugg (self, sSugg, nDeep=0): "add a suggestion" #logging.info((nDeep * " ") + "__" + sSugg + "__") if sSugg in self.aAllSugg: return self.aAllSugg.add(sSugg) if sSugg not in self.aSugg: nDist = st.distanceDamerauLevenshtein(self.sSimplifiedWord, cp.simplifyWord(sSugg)) if nDist <= self.nDistLimit: if nDist not in self.dSugg: self.dSugg[nDist] = [] self.dSugg[nDist].append(sSugg) self.aSugg.add(sSugg) |
︙ |