Charty/resources/ChartyPy.py
def struct2Str(edge, chart, grammar):
   """Returns a string representation of the parse with
      labled brackets.

      Parameters:
      edges - the lsit of edges that make a parse
      chart - the current chart (list of edges)
   """
   tmpstr = ""
   edgenums = chart[edge][5]
   tmpstr = "".join((tmpstr, "[", grammar.id2s(chart[edge][3])))
   for x in chart[edge][4]:
      if grammar.isTerminal(x):
         tmpstr = " ".join( (tmpstr, grammar.id2s(x)) )
      else:
         tmpstr = " ".join( (tmpstr, struct2Str(edgenums[0], chart, grammar)) )
         edgenums = edgenums[1:]
   tmpstr = "".join( (tmpstr, " ]") )
   return tmpstr
Returns a string representation of the parse with
      labled brackets.

      Parameters:
      edges - the lsit of edges that make a parse
      chart - the current chart (list of edges)
   
Returns a string representation of the parse with
labled brackets.

the lsit of edges that make a parse
chart - the current chart (list of edges)
Returns a string representation of the parse with labled brackets . the lsit of edges that make a parse chart - the current chart ( list of edges )
def struct2Str(edge, chart, grammar):
   tmpstr = ""
   edgenums = chart[edge][5]
   tmpstr = "".join((tmpstr, "[", grammar.id2s(chart[edge][3])))
   for x in chart[edge][4]:
      if grammar.isTerminal(x):
         tmpstr = " ".join( (tmpstr, grammar.id2s(x)) )
      else:
         tmpstr = " ".join( (tmpstr, struct2Str(edgenums[0], chart, grammar)) )
         edgenums = edgenums[1:]
   tmpstr = "".join( (tmpstr, " ]") )
   return tmpstr
def struct2Str ( edge , chart , grammar ) : tmpstr = "" edgenums = chart [ edge ] [ 5 ] tmpstr = "" . join ( ( tmpstr , "[" , grammar . id2s ( chart [ edge ] [ 3 ] ) ) ) for x in chart [ edge ] [ 4 ] : if grammar . isTerminal ( x ) : tmpstr = " " . join ( ( tmpstr , grammar . id2s ( x ) ) ) else : tmpstr = " " . join ( ( tmpstr , struct2Str ( edgenums [ 0 ] , chart , grammar ) ) ) edgenums = edgenums [ 1 : ] tmpstr = "" . join ( ( tmpstr , " ]" ) ) return tmpstr
Returns a string representation of the parse with
labled brackets.
Returns a string representation of the parse with labled brackets .
"""Returns a string representation of the parse with
      labled brackets.

      Parameters:
      edges - the lsit of edges that make a parse
      chart - the current chart (list of edges)
   """
edge
chart
grammar