Saturday, November 4, 2017

The Expected but Missing in a narrative pattern

I am particularly proud of these lines of code:

  if 0.25 _le_ node.GOF and node.GOF _le_ 0.75:
   # find the missing node (if there is just one)
   EBM = node.nar.getExpectedButMissing()
   if EBM==NULL_VAR :
      continue

   #convert the context into children of that node
   a = self.C.getAll() 
   a2  = EBM.filter(a)
   if len(a2)==0:
      continue


The routine then proceeds to grab as many entries from a2 as needed, if available, and inserts them into the incomplete narrative.

No comments:

Post a Comment