in modeling/coval/conll/mention.py [0:0]
def get_valid_tags(self, root):
valid_tags = None
NP_tags = ['NP', 'NM', 'QP', 'NX']
VP_tags = ['VP']
if root.tag[0:2]=='VP':
valid_tags = VP_tags
elif root.tag[0:2] in ['NP', 'NM']:
valid_tags = NP_tags
else:
if root.children: ## If none of the first level nodes are either NP or VP, examines their children for valid mention tags
all_tags = []
for node in root.children:
all_tags.append(node.tag[0:2])
if 'NP' in all_tags or 'NM' in all_tags:
valid_tags = NP_tags
elif 'VP' in all_tags:
valid_tags = VP_tags
else:
valid_tags = NP_tags
return valid_tags