Enhance language.py to allow pipe() to work with Doc iterator
Given the improvement that comes from using pipe() over nlp(), would it be possible to enhance language.py::pipe() to take an argument as_docs=False, which, if set to True, would use an iterator over Doc objects instead of strings?
This would allow the use of pre-tokenized text, and arbitrary pre-processing, while retaining the batch advantages of the core NLP models.
Nah, just set the tokenizer to a noop:
nlp = Language(make_doc=lambda doc: doc)
Or if you've already created the object:
nlp.tokenizer = lambda doc: doc
What might be nice would be to have a context manager with_tokenizer, where such a replacement could be block-scoped.
Fair enough--I hadn't thought about that. Elegant, if a little implicit :) This solves my issue--feeding pre-tokenized docs to the pipe... Thanks.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.