def merge_subtokens(doc, label="<STR_LIT>"):
merger = Matcher(doc.vocab)<EOL>merger.add("<STR_LIT>", None, [{"<STR_LIT>": label, "<STR_LIT>": "<STR_LIT:+>"}])<EOL>matches = merger(doc)<EOL>spans = [doc[start : end + <NUM_LIT:1>] for _, start, end in matches]<EOL>with doc.retokenize() as retokenizer:<EOL><INDENT>for span in spans:<EOL><INDENT>retokenizer.merge(span)<EOL><DEDENT><DEDENT>return doc<EOL>
Merge subtokens into a single token.

    doc (Doc): The Doc object.
    label (unicode): The subtoken dependency label.
    RETURNS (Doc): The Doc object with merged subtokens.

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