Ignore 2 root node types in PTB parsing reader
Some variants of the PTB dataset use `TOP` as the root node, rather than `VROOT`. This lets the dataset reader handle both.
@@ -69,7 +69,7 @@ class PennTreeBankConstituencySpanDatasetReader(DatasetReader):
self._strip_functional_tags(parse)
# This is un-needed and clutters the label space.
# All the trees also contain a root S node.
- if parse.label() == "VROOT":
+ if parse.label() == "VROOT" or parse.label() == "TOP":
parse = parse[0]
pos_tags = [x[1] for x in parse.pos()] if self._use_pos_tags else None
yield self.text_to_instance(parse.leaves(), pos_tags, parse)
