def pipe(<EOL>self,<EOL>texts,<EOL>as_tuples=False,<EOL>n_threads=-<NUM_LIT:1>,<EOL>batch_size=<NUM_LIT:1000>,<EOL>disable=[],<EOL>cleanup=False,<EOL>component_cfg=None,<EOL>):
if n_threads != -<NUM_LIT:1>:<EOL><INDENT>deprecation_warning(Warnings.W016)<EOL><DEDENT>if as_tuples:<EOL><INDENT>text_context1, text_context2 = itertools.tee(texts)<EOL>texts = (tc[<NUM_LIT:0>] for tc in text_context1)<EOL>contexts = (tc[<NUM_LIT:1>] for tc in text_context2)<EOL>docs = self.pipe(<EOL>texts,<EOL>batch_size=batch_size,<EOL>disable=disable,<EOL>component_cfg=component_cfg,<EOL>)<EOL>for doc, context in izip(docs, contexts):<EOL><INDENT>yield (doc, context)<EOL><DEDENT>return<EOL><DEDENT>docs = (self.make_doc(text) for text in texts)<EOL>if component_cfg is None:<EOL><INDENT>component_cfg = {}<EOL><DEDENT>for name, proc in self.pipeline:<EOL><INDENT>if name in disable:<EOL><INDENT>continue<EOL><DEDENT>kwargs = component_cfg.get(name, {})<EOL>kwargs.setdefault("<STR_LIT>", batch_size)<EOL>if hasattr(proc, "<STR_LIT>"):<EOL><INDENT>docs = proc.pipe(docs, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>docs = _pipe(proc, docs, kwargs)<EOL><DEDENT><DEDENT>recent_refs = weakref.WeakSet()<EOL>old_refs = weakref.WeakSet()<EOL>original_strings_data = None<EOL>nr_seen = <NUM_LIT:0><EOL>for doc in docs:<EOL><INDENT>yield doc<EOL>if cleanup:<EOL><INDENT>recent_refs.add(doc)<EOL>if nr_seen < <NUM_LIT>:<EOL><INDENT>old_refs.add(doc)<EOL>nr_seen += <NUM_LIT:1><EOL><DEDENT>elif len(old_refs) == <NUM_LIT:0>:<EOL><INDENT>old_refs, recent_refs = recent_refs, old_refs<EOL>if original_strings_data is None:<EOL><INDENT>original_strings_data = list(self.vocab.strings)<EOL><DEDENT>else:<EOL><INDENT>keys, strings = self.vocab.strings._cleanup_stale_strings(<EOL>original_strings_data<EOL>)<EOL>self.vocab._reset_cache(keys, strings)<EOL>self.tokenizer._reset_cache(keys)<EOL><DEDENT>nr_seen = <NUM_LIT:0><EOL><DEDENT><DEDENT><DEDENT>
Process texts as a stream, and yield `Doc` objects in order.

        texts (iterator): A sequence of texts to process.
        as_tuples (bool): If set to True, inputs should be a sequence of
            (text, context) tuples. Output will then be a sequence of
            (doc, context) tuples. Defaults to False.
        batch_size (int): The number of texts to buffer.
        disable (list): Names of the pipeline components to disable.
        cleanup (bool): If True, unneeded strings are freed to control memory
            use. Experimental.
        component_cfg (dict): An optional dictionary with extra keyword
            arguments for specific components.
        YIELDS (Doc): Documents in the order of the original text.

        DOCS: https://spacy.io/api/language#pipe