(tok: Token)
return tok_and_conjuncts + compounds
Expand a noun token to include all associated conjunct and compound nouns.
Expand a noun token to include all associated conjunct and compound nouns.
Expand a noun token to include all associated conjunct and compound nouns .
def expand_noun(tok: Token) -> List[Token]:
    """Expand a noun token to include all associated conjunct and compound nouns."""
    tok_and_conjuncts = [tok] + list(tok.conjuncts)
    compounds = [
        child
        for tc in tok_and_conjuncts
        for child in tc.children
        # TODO: why doesn't compound import from spacy.symbols?
        if child.dep_ == "compound"
    ]
    return tok_and_conjuncts + compounds
def expand_noun ( tok : Token ) -> List [ Token ] : tok_and_conjuncts = [ tok ] + list ( tok . conjuncts ) compounds = [ child for tc in tok_and_conjuncts for child in tc . children # TODO: why doesn't compound import from spacy.symbols? if child . dep_ == "compound" ] return tok_and_conjuncts + compounds