Fix Language.evaluate

This commit is contained in:
Matthew Honnibal 2017-08-06 02:18:31 +02:00
parent 0a566dc320
commit 0eec7c9e9b
1 changed files with 6 additions and 2 deletions

View File

@ -382,9 +382,13 @@ class Language(object):
return optimizer return optimizer
def evaluate(self, docs_golds): def evaluate(self, docs_golds):
docs, golds = zip(*docs_golds)
scorer = Scorer() scorer = Scorer()
for doc, gold in zip(self.pipe(docs, batch_size=32), golds): docs, golds = zip(*docs_golds)
docs = list(docs)
golds = list(golds)
for pipe in self.pipeline:
docs = pipe.pipe(docs)
for doc, gold in zip(docs, golds):
scorer.score(doc, gold) scorer.score(doc, gold)
doc.tensor = None doc.tensor = None
return scorer return scorer