【发布时间】:2020-10-17 17:30:39
【问题描述】:
基于此链接: Is it possible to use spacy with already tokenized input?
我可以让 Spacy 将标记化的文档作为输入并进一步处理该文档。代码如下:
def nlp_process(self, token_tuple):
# token_tuple = ("This is a test", ['This','is','a','test'])
doc = Doc(self.nlp.vocab, words=token_tuple[1])
for name, proc in self.nlp.pipeline:
doc = proc(doc)
return doc
这适用于单输入。如果我想使用 nlp.pipe() 函数以批处理模式处理文档怎么办?比如:
nlp_docs = self.nlp.pipe(texts)
管道采用原始文本列表。这种情况该如何处理?
【问题讨论】:
标签: spacy