def is_np_internal_structure(node): # rule out things already tagged explicitly as coordination by tag.py if any(has_tags(kid, 'cC') for kid in node): return False return (node.tag.startswith('NP') and all( has_tags(kid, 'nN') or any( kid.tag.startswith(tag) for tag in NominalCategories) or kid.tag in ('PU', 'CC') or kid.tag.startswith('JJ') or kid.tag.startswith('CD') or kid.tag.startswith('OD') or has_tag(kid, '&') for kid in leaves(node)))
def is_np_internal_structure(node): # rule out things already tagged explicitly as coordination by tag.py if any(has_tags(kid, 'cC') for kid in node): return False return (node.tag.startswith('NP') and all(has_tags(kid, 'nN') or any(kid.tag.startswith(tag) for tag in NominalCategories) or kid.tag in ('PU', 'CC') or kid.tag.startswith('JJ') or kid.tag.startswith('CD') or kid.tag.startswith('OD') or has_tag(kid, '&') for kid in leaves(node)))
def is_np_structure(node): # These tags are attested NP modifiers # rule out NP-PRD as NP structure (0:88(15)) # rule out things already tagged explicitly as coordination by tag.py if any(has_tags(kid, 'cC') for kid in node): return False return node.tag.startswith('NP') and all( (any(kid.tag.startswith(cat) for cat in NominalCategories)) or kid.tag.startswith('ADJP') or kid.tag.startswith('QP') or kid.tag.startswith('CD') or kid.tag.startswith('DP') or kid.tag.startswith('DT') or # 24:98(3) kid.tag.startswith('PN') or kid.tag.startswith('CP') or kid.tag.startswith('DNP') or kid.tag.startswith('ADVP') or kid.tag.startswith('AD') or kid.tag.startswith('IP') or kid.tag.startswith('JJ') or # JJ is in here because ADJP < JJ may have been shrunk already kid.tag.startswith('LCP') or kid.tag.startswith('CLP') or # 0:57(12) reduced M kid.tag.startswith('PP') or kid.tag in ("PU", "CC") or # CC for underspecified NP (27:24(3)) kid.tag.startswith('NP') or kid.tag.startswith('WHNP') or # 9:30(13) kid.tag.startswith('FLR') or # ignore FLR kid.tag.startswith('SP') or # ignore SP has_tag(kid, 'p') for kid in node)
def is_np_structure(node): # These tags are attested NP modifiers # rule out NP-PRD as NP structure (0:88(15)) # rule out things already tagged explicitly as coordination by tag.py if any(has_tags(kid, 'cC') for kid in node): return False return node.tag.startswith('NP') and all( (any(kid.tag.startswith(cat) for cat in NominalCategories)) or kid.tag.startswith('ADJP') or kid.tag.startswith('QP') or kid.tag.startswith('CD') or kid.tag.startswith('DP') or kid.tag.startswith('DT') or # 24:98(3) kid.tag.startswith('PN') or kid.tag.startswith('CP') or kid.tag. startswith('DNP') or kid.tag.startswith('ADVP') or kid.tag.startswith( 'AD') or kid.tag.startswith('IP') or kid.tag.startswith('JJ') or # JJ is in here because ADJP < JJ may have been shrunk already kid.tag.startswith('LCP') or kid.tag.startswith('CLP') or # 0:57(12) reduced M kid.tag.startswith('PP') or kid.tag in ("PU", "CC") or # CC for underspecified NP (27:24(3)) kid.tag.startswith('NP') or kid.tag.startswith('WHNP') or # 9:30(13) kid.tag.startswith('FLR') or # ignore FLR kid.tag.startswith('SP') or # ignore SP has_tag(kid, 'p') for kid in node)
def postprocess(root): use_lcp_to_np = config.lcp_to_np_typechange for node in nodes(root): # Exclude the conjuncts in LCP coordination: we want the LCP->NP promotion to apply once to the result of the coordination if use_lcp_to_np and node.tag.startswith('LCP') and has_tags(node, 'lr'): # if we're in LCP coordination then we want to protect the conjuncts from being converted new_node = Node('NP', [node]) node.parent = new_node inherit_tag(new_node, node) replace_kid(node.parent, node, new_node) return root
def postprocess(root): use_lcp_to_np = config.lcp_to_np_typechange for node in nodes(root): # Exclude the conjuncts in LCP coordination: we want the LCP->NP promotion to apply once to the result of the coordination if use_lcp_to_np and node.tag.startswith('LCP') and has_tags( node, 'lr'): # if we're in LCP coordination then we want to protect the conjuncts from being converted new_node = Node('NP', [node]) node.parent = new_node inherit_tag(new_node, node) replace_kid(node.parent, node, new_node) return root
def is_right_adjunction(node): return has_tags(node[1], 'ap')