Grammalecte  Check-in [94f5da9f4a]

Overview
Comment:[core] ibdawg: add next node when drawing path of a word
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256: 94f5da9f4a051e893ad2d3df37d93e9997b9909b2b73668baaefe90309629142
User & Date: olr on 2017-06-29 04:16:25
Other Links: manifest | tags
Context
2017-06-29
13:20
[core] dawg: attempt to speed up the dictionary lookup by reordering arcs (pointless ATM) check-in: b038740434 user: olr tags: trunk, core
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
Changes

Modified gc_core/py/ibdawg.py from [b249dfb9bf] to [cbe111edf6].

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
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







-
+
-


-
+







+
+







        for c in cp.d1to1.get(cChar, [cChar]):
            if c in self.dChar:
                jAddr = self._lookupArcNode(self.dChar[c], iAddr)
                if jAddr:
                    yield (c, jAddr)

    def drawPath (self, sWord, iAddr=0):
        if not sWord:
        cChar = sWord[0:1]  if sWord  else " "
            return
        iPos = -1
        n = 0
        print(sWord[0:1] + ": ", end="")
        print(cChar + ": ", end="")
        for nVal, jAddr in self._getArcs(iAddr):
            if nVal in self.dCharVal:
                print(self.dCharVal[nVal], end="")
                if self.dCharVal[nVal] == sWord[0:1]:
                    iNextNodeAddr = jAddr
                    iPos = n
                n += 1
        if not sWord:
            return
        if iPos >= 0:
            print("\n   "+ " " * iPos + "|")
            self.drawPath(sWord[1:], iNextNodeAddr)


    # def morph (self, sWord):
    #     is defined in __init__