Use Language.pipe in evaluate (#9800)

This commit is contained in:
Adriane Boyd 2021-12-06 20:39:15 +01:00 committed by GitHub
parent 9964243eb2
commit a0cdc2b007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 14 deletions

View File

@ -1404,20 +1404,13 @@ class Language:
for eg in examples: for eg in examples:
self.make_doc(eg.reference.text) self.make_doc(eg.reference.text)
# apply all pipeline components # apply all pipeline components
for name, pipe in self.pipeline: docs = self.pipe(
kwargs = component_cfg.get(name, {}) (eg.predicted for eg in examples),
kwargs.setdefault("batch_size", batch_size) batch_size=batch_size,
for doc, eg in zip( component_cfg=component_cfg,
_pipe( )
(eg.predicted for eg in examples), for eg, doc in zip(examples, docs):
proc=pipe, eg.predicted = doc
name=name,
default_error_handler=self.default_error_handler,
kwargs=kwargs,
),
examples,
):
eg.predicted = doc
end_time = timer() end_time = timer()
results = scorer.score(examples) results = scorer.score(examples)
n_words = sum(len(eg.predicted) for eg in examples) n_words = sum(len(eg.predicted) for eg in examples)