Beispiel #1
0
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)
Beispiel #2
0
def parsetree(s, *args, **kwargs):
    """ Returns a parsed Text from the given string.
    """
    return Text(parse(s, *args, **kwargs))
Beispiel #3
0
def split(s, token=[WORD, POS, CHUNK, PNP]):
    """ Returns a parsed Text from the given parsed string.
    """
    return Text(s, token)
Beispiel #4
0
def split(s, token=[WORD, POS, CHUNK, PNP]):
    return Text(s, token)