Pretty-prints the output of Parser.parse() as a table with outlined columns. Alternatively, you can supply a tree.Text or tree.Sentence object.
(string, token=[WORD, POS, CHUNK, PNP], column=4)
| 86 | return g |
| 87 | |
| 88 | def pprint(string, token=[WORD, POS, CHUNK, PNP], column=4): |
| 89 | """ Pretty-prints the output of Parser.parse() as a table with outlined columns. |
| 90 | Alternatively, you can supply a tree.Text or tree.Sentence object. |
| 91 | """ |
| 92 | if isinstance(string, basestring): |
| 93 | print "\n\n".join([table(sentence, fill=column) for sentence in Text(string, token)]) |
| 94 | if isinstance(string, Text): |
| 95 | print "\n\n".join([table(sentence, fill=column) for sentence in string]) |
| 96 | if isinstance(string, Sentence): |
| 97 | print table(string, fill=column) |
| 98 | |
| 99 | #--- LAZY DICTIONARY ------------------------------------------------------------------------------- |
| 100 | # A lazy dictionary is empty until one of its methods is called. |