arsenal.nlp.data package¶
Submodules¶
arsenal.nlp.data.ptb module¶
-
arsenal.nlp.data.ptb.pprint(t, out=<built-in method write of _io.TextIOWrapper object>)[source]¶ Pretty print tree as a tabbified s-expression.
-
arsenal.nlp.data.ptb.print_parse(t, out=<built-in method write of _io.TextIOWrapper object>)[source]¶ Print parse formatted as an s-expression.
-
arsenal.nlp.data.ptb.sexpr(s, add_root=True)[source]¶ Example usage:
>>> sexpr('(S (NP Papa) (VP (V ate) (NP (Det the) (N caviar))))') ['S', ['NP', 'Papa'], ['VP', ['V', 'ate'], ['NP', ['Det', 'the'], ['N', 'caviar']]]]
TO match the Penn tree bank we add a ROOT symbol in the following case
>>> sexpr('((S (NP Papa) (VP (V ate) (NP (Det the) (N caviar)))))') ['ROOT', ['S', ['NP', 'Papa'], ['VP', ['V', 'ate'], ['NP', ['Det', 'the'], ['N', 'caviar']]]]]