mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Add support for verbose flag to Language
This commit is contained in:
parent
02586a5243
commit
96da86b3e5
|
@ -388,7 +388,7 @@ class Language(object):
|
||||||
self._optimizer.device = device
|
self._optimizer.device = device
|
||||||
return self._optimizer
|
return self._optimizer
|
||||||
|
|
||||||
def evaluate(self, docs_golds):
|
def evaluate(self, docs_golds, verbose=False):
|
||||||
scorer = Scorer()
|
scorer = Scorer()
|
||||||
docs, golds = zip(*docs_golds)
|
docs, golds = zip(*docs_golds)
|
||||||
docs = list(docs)
|
docs = list(docs)
|
||||||
|
@ -401,7 +401,9 @@ class Language(object):
|
||||||
docs = list(pipe.pipe(docs))
|
docs = list(pipe.pipe(docs))
|
||||||
assert len(docs) == len(golds)
|
assert len(docs) == len(golds)
|
||||||
for doc, gold in zip(docs, golds):
|
for doc, gold in zip(docs, golds):
|
||||||
scorer.score(doc, gold)
|
if verbose:
|
||||||
|
print(doc)
|
||||||
|
scorer.score(doc, gold, verbose=verbose)
|
||||||
return scorer
|
return scorer
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|
Loading…
Reference in New Issue
Block a user