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: core, trunk
04:16
[core] ibdawg: add next node when drawing path of a word check-in: 94f5da9f4a user: olr tags: core, trunk
2017-06-28
19:40
[core] ibdawg: draw path taken by word in dawg check-in: d99a910d73 user: olr tags: core, trunk
Changes

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

   262    262           for c in cp.d1to1.get(cChar, [cChar]):
   263    263               if c in self.dChar:
   264    264                   jAddr = self._lookupArcNode(self.dChar[c], iAddr)
   265    265                   if jAddr:
   266    266                       yield (c, jAddr)
   267    267   
   268    268       def drawPath (self, sWord, iAddr=0):
   269         -        if not sWord:
   270         -            return
          269  +        cChar = sWord[0:1]  if sWord  else " "
   271    270           iPos = -1
   272    271           n = 0
   273         -        print(sWord[0:1] + ": ", end="")
          272  +        print(cChar + ": ", end="")
   274    273           for nVal, jAddr in self._getArcs(iAddr):
   275    274               if nVal in self.dCharVal:
   276    275                   print(self.dCharVal[nVal], end="")
   277    276                   if self.dCharVal[nVal] == sWord[0:1]:
   278    277                       iNextNodeAddr = jAddr
   279    278                       iPos = n
   280    279                   n += 1
          280  +        if not sWord:
          281  +            return
   281    282           if iPos >= 0:
   282    283               print("\n   "+ " " * iPos + "|")
   283    284               self.drawPath(sWord[1:], iNextNodeAddr)
   284    285   
   285    286   
   286    287       # def morph (self, sWord):
   287    288       #     is defined in __init__