def make_lex(symbols):
 lex = []
 header = u"\n##################################################################\n# Lexical rules automatically generated by running 'chat80.py -x'.\n##################################################################\n\n"
 lex.append(header)
 template = u"PropN[num=sg, sem=<\\P.(P %s)>] -> '%s'\n"
 for s in symbols:
  parts = s.split(u'_')
  caps = [p.capitalize() for p in parts]
  pname = u'_'.join(caps)
  rule = (template % (s, pname))
  lex.append(rule)
 return lex

def make_lex ( symbols ) : lex = [ ] header = u"\n##################################################################\n# Lexical rules automatically generated by running 'chat80.py -x'.\n##################################################################\n\n" lex . append ( header ) template = u"PropN[num=sg, sem=<\\P.(P %s)>] -> '%s'\n" for s in symbols : parts = s . split ( u'_' ) caps = [ p . capitalize ( ) for p in parts ] pname = u'_' . join ( caps ) rule = ( template % ( s , pname ) ) lex . append ( rule ) return lex
create lexical cfg rules for each individual symbol .