(spans: Iterable[Span], doc: Doc)
Merge spans into single tokens in ``doc``, *in-place*.

    Args:
        spans (Iterable[:class:`spacy.tokens.Span`])
        doc (:class:`spacy.tokens.Doc`)
Merge spans into single tokens in ``doc``, *in-place*.
Merge spans into single tokens in doc * in - place * .
def merge_spans(spans: Iterable[Span], doc: Doc) -> None:
    """
    Merge spans into single tokens in ``doc``, *in-place*.

    Args:
        spans (Iterable[:class:`spacy.tokens.Span`])
        doc (:class:`spacy.tokens.Doc`)
    """
    with doc.retokenize() as retokenizer:
        string_store = doc.vocab.strings
        for span in spans:
            retokenizer.merge(
                doc[span.start : span.end],
                attrs=attrs.intify_attrs({"ent_type": span.label}, string_store),
            )
def merge_spans ( spans : Iterable [ Span ] , doc : Doc ) -> None : with doc . retokenize ( ) as retokenizer : string_store = doc . vocab . strings for span in spans : retokenizer . merge ( doc [ span . start : span . end ] , attrs = attrs . intify_attrs ( { "ent_type" : span . label } , string_store ) , )