def merge_noun_chunks(doc):
if not doc.is_parsed:<EOL><INDENT>return doc<EOL><DEDENT>with doc.retokenize() as retokenizer:<EOL><INDENT>for np in doc.noun_chunks:<EOL><INDENT>attrs = {"<STR_LIT>": np.root.tag, "<STR_LIT>": np.root.dep}<EOL>retokenizer.merge(np, attrs=attrs)<EOL><DEDENT><DEDENT>return doc<EOL>
Merge noun chunks into a single token.

    doc (Doc): The Doc object.
    RETURNS (Doc): The Doc object with merged noun chunks.

    DOCS: https://spacy.io/api/pipeline-functions#merge_noun_chunks