Fix Language.update for pipeline

This commit is contained in:
Matthew Honnibal 2017-08-06 14:13:03 +02:00
parent bfffdeabb2
commit 0acce0521b

View File

@ -387,7 +387,12 @@ class Language(object):
docs = list(docs)
golds = list(golds)
for pipe in self.pipeline:
docs = pipe.pipe(docs)
if not hasattr(pipe, 'pipe'):
for doc in docs:
pipe(doc)
else:
docs = list(pipe.pipe(docs))
assert len(docs) == len(golds)
for doc, gold in zip(docs, golds):
scorer.score(doc, gold)
doc.tensor = None