Python 如何使spacy管道元素的输出成为另一个元素的输入?

Python 如何使spacy管道元素的输出成为另一个元素的输入?,python,nlp,spacy,Python,Nlp,Spacy,在文档中我还没有澄清的是如何在spacy中创建文本处理管道。考虑这一点: nlp = spacy.load("en_core_web_lg") coref = neuralcoref.NeuralCoref(nlp.vocab) nlp.add_pipe(coref, name='neuralcoref') tr = pytextrank.TextRank() nlp.add_pipe(tr.PipelineComponent, name="textrank&qu

在文档中我还没有澄清的是如何在spacy中创建文本处理管道。考虑这一点:

nlp = spacy.load("en_core_web_lg")

coref = neuralcoref.NeuralCoref(nlp.vocab)
nlp.add_pipe(coref, name='neuralcoref')
tr = pytextrank.TextRank()
nlp.add_pipe(tr.PipelineComponent, name="textrank")
我有2个自定义管道元素。具有TextRank的共引用解析器和短语提取器。现在,我想在共指解析器完成工作后提取短语。然而,它似乎不是这样工作的

nlp('David likes food, he likes to eat alot')._.coref_resolved
#David likes food, David likes to eat alot

nlp('David likes food, he likes to eat alot')._.phrases
#[food, david, he] <- 'he' should not be here
nlp(“大卫喜欢食物,他喜欢吃很多”)
#大卫喜欢食物,大卫喜欢吃很多
nlp(“大卫喜欢食物,他喜欢吃很多”)
#[食物,大卫,他]