BLLIP reranking parser (also known as Charniak-Johnson parser, Charniak parser, Brown reranking parser) See http://pypi.python.org/pypi/bllipparser/ for Python module.
>>> from bllipparser import Tree
>>> s = '(S1 (NNS Markets) (: --))' # valid tree
>>> t1 = Tree('(())') # invalid tree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/bllipparser/RerankingParser.py", line 63, in __init__
parser.inputTreeFromString(input_tree_or_string)
RuntimeError: [first-stage/PARSE/utils.C:52]: Saw paren rather than term
>>> Tree(s) # crashes 1st time
Saw )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/bllipparser/RerankingParser.py", line 63, in __init__
parser.inputTreeFromString(input_tree_or_string)
RuntimeError: [first-stage/PARSE/utils.C:52]: Should have seen an open paren here.
>>> Tree(s) # succeeds 2nd time
Tree('(S1 (NNS Markets) (: --))')
Example:
(Thanks @cdg720 for catching this!)