-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
A (bad) parse containing 2 ROOT labels (in a unary chain) causes a crash and
Python stack trace. Yes, this is a strange edge case, but I ran into it and
thought I'd report it.
What steps will reproduce the problem?
echo "(ROOT (NP (DT The) (NN cat)))" >goldnp
echo "(ROOT (ROOT (NP (DT The) (NN cat))))" >doublerootnp
classify_english.py goldnp doublerootnp doublerooteval
Resulting stack trace:
Traceback (most recent call last):
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/classify_english.py", line 172, in <module>
main(sys.argv, classify)
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/transform_search.py", line 419, in main
compare(gold_text.strip(), test_text.strip(), out_dict, error_counts, classify)
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/transform_search.py", line 372, in compare
compare_trees(gold_tree, test_tree, out_dict, error_counts, classify)
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/transform_search.py", line 302, in compare_trees
iters, path = greedy_search(gold_tree, test_tree, classify)
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/transform_search.py", line 279, in greedy_search
for fixes, ntree, info in successors(ctree, cerrors, gold):
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/transform_search.py", line 195, in successors
yield gen_extra_successor(ctree, error, gold)
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/transform_search.py", line 80, in gen_extra_successor
success, response = tree_transform.remove_node(ctree, error[1], error[2], in_place=False)
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/nlp_util/tree_transform.py", line 99, in remove_node
return remove_node_by_span(tree, span, label, position, in_place)
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/nlp_util/tree_transform.py", line 91, in remove_node_by_span
return remove_node_by_node(nodes[position], in_place)
File "/Users/ajdunlop/Dropbox/nlpbin/parser_analyzer/nlp_util/tree_transform.py", line 74, in remove_node_by_node
position = parent.subtrees.index(node)
AttributeError: 'NoneType' object has no attribute 'subtrees'
What version of the product are you using? On what operating system?
Aug 2013 version of berkeley-parser-analyzer
Mac OS 10.9
Python version = 2.7.5
Original issue reported on code.google.com by [email protected]
on 13 Aug 2014 at 9:51