def merge_entities(doc):
with doc.retokenize() as retokenizer:<EOL><INDENT>for ent in doc.ents:<EOL><INDENT>attrs = {"<STR_LIT>": ent.root.tag, "<STR_LIT>": ent.root.dep, "<STR_LIT>": ent.label}<EOL>retokenizer.merge(ent, attrs=attrs)<EOL><DEDENT><DEDENT>return doc<EOL>
Merge entities into a single token.

    doc (Doc): The Doc object.
    RETURNS (Doc): The Doc object with merged entities.

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