def pprint(string, token=[WORD, POS, CHUNK, PNP], column=4): """ Pretty-prints the output of parse() as a table with outlined columns. Alternatively, you can supply a Text or Sentence object. """ if isinstance(string, basestring): print "\n\n".join( [table(sentence, fill=column) for sentence in Text(string, token)]) if isinstance(string, Text): print "\n\n".join( [table(sentence, fill=column) for sentence in string]) if isinstance(string, Sentence): print table(string, fill=column)
def parsetree(s, *args, **kwargs): """ Returns a parsed Text from the given string. """ return Text(parse(s, *args, **kwargs))
def split(s, token=[WORD, POS, CHUNK, PNP]): """ Returns a parsed Text from the given parsed string. """ return Text(s, token)
def split(s, token=[WORD, POS, CHUNK, PNP]): return Text(s, token)