Example #1
0
sym = bool(opts.sym)
subcat = bool(opts.subcat)
fun = bool(opts.fun)
pcfg = bool(opts.pcfg)
top = int(opts.top)
traces = bool(opts.traces)
lncky = bool(opts.lncky)

if source == 'xml':
     reader = XmlReader()
     if input_file <> None :
          if os.path.isdir(input_file):
               treebank =  reader.read_dir_xml(input_file)
          else:
               instream = open(input_file)
               treebank = reader.read_xml(instream)
     else:
          treebank = reader.read_xml(sys.stdin)
elif source=='penn':
     stream  = sys.stdin.read()
     reader = PtbReader(drparser=True)
     treebank = reader.parse_treebank(stream)
else :
     print "invalid source format\n"
     sys.exit(1)


freq = FrequencyTable(subcat,not traces)

if all:
     raw = True