Overview
Comment: | [core] ibdawg: draw path taken by word in dawg |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | core |
Files: | files | file ages | folders |
SHA3-256: |
d99a910d73b7e8555099926b4d0e55a6 |
User & Date: | olr on 2017-06-28 19:40:53 |
Other Links: | manifest | tags |
Context
2017-06-29
| ||
04:16 | [core] ibdawg: add next node when drawing path of a word check-in: 94f5da9f4a user: olr tags: trunk, core | |
2017-06-28
| ||
19:40 | [core] ibdawg: draw path taken by word in dawg check-in: d99a910d73 user: olr tags: trunk, core | |
06:16 | [fr] nr: confusion <la/l’a> check-in: f47e4bd4a5 user: olr tags: trunk, fr | |
Changes
Modified cli.py from [8ec24a7015] to [2ae9df701e].
︙ | |||
204 205 206 207 208 209 210 211 212 213 214 215 216 217 | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | + + | echo("* " + sWord) for sMorph in oDict.getMorph(sWord): echo(" {:<32} {}".format(sMorph, oLexGraphe.formatTags(sMorph))) elif sText.startswith("!"): for sWord in sText[1:].strip().split(): if sWord: echo(" | ".join(oDict.suggest(sWord))) elif sText.startswith(">"): oDict.drawPath(sText[1:].strip()) elif sText.startswith("/+ "): gce.setOptions({ opt:True for opt in sText[3:].strip().split() if opt in gce.getOptions() }) echo("done") elif sText.startswith("/- "): gce.setOptions({ opt:False for opt in sText[3:].strip().split() if opt in gce.getOptions() }) echo("done") elif sText.startswith("/-- "): |
︙ |
Modified gc_core/py/ibdawg.py from [303901f49a] to [b249dfb9bf].
︙ | |||
52 53 54 55 56 57 58 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | - + - + | if self.cStemming == "S": self.funcStemming = st.changeWordWithSuffixCode elif self.cStemming == "A": self.funcStemming = st.changeWordWithAffixCode else: self.funcStemming = st.noStemming self.nTag = self.nArcVal - self.nChar - self.nAff |
︙ | |||
170 171 172 173 174 175 176 177 178 179 180 181 182 183 | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | + + + + + + + + + | for c in sWord: if c not in self.dChar: return False iAddr = self._lookupArcNode(self.dChar[c], iAddr) if iAddr == None: return False return bool(int.from_bytes(self.byDic[iAddr:iAddr+self.nBytesArc], byteorder='big') & self._finalNodeMask) def getMorph (self, sWord): "retrieves morphologies list, different casing allowed" l = self.morph(sWord) if sWord[0:1].isupper(): l.extend(self.morph(sWord.lower())) if sWord.isupper() and len(sWord) > 1: l.extend(self.morph(sWord.capitalize())) return l def suggest (self, sWord): "returns a set of similar words" # first, we check for similar words #return set(self._suggestWithCrushedUselessChars(cp.clearWord(sWord))) lSugg = self._suggest(sWord) if not lSugg: |
︙ | |||
244 245 246 247 248 249 250 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | - - + + - - - - - - - - + + + + + + + + + + + + + + + + + | show(nDeep, cChar) lSugg.extend(self._suggestWithCrushedUselessChars(sWord[1:], nDeep+1, jAddr, sNewWord+cChar)) return lSugg def _getSimilarArcsAndCrushedChars (self, cChar, iAddr): "generator: yield similar char of <cChar> and address of the following node" for nVal, jAddr in self._getArcs(iAddr): |
︙ |