Fix Example usage in evaluate

This commit is contained in:
Matthew Honnibal 2020-06-27 21:15:25 +02:00
parent 42eb381ec6
commit d8c70b415e

View File

@ -72,7 +72,7 @@ def evaluate(
begin = timer() begin = timer()
scorer = nlp.evaluate(dev_dataset, verbose=False) scorer = nlp.evaluate(dev_dataset, verbose=False)
end = timer() end = timer()
nwords = sum(len(ex.doc) for ex in dev_dataset) nwords = sum(len(ex.predicted) for ex in dev_dataset)
results = { results = {
"Time": f"{end - begin:.2f} s", "Time": f"{end - begin:.2f} s",
"Words": nwords, "Words": nwords,
@ -95,7 +95,7 @@ def evaluate(
msg.table(results, title="Results") msg.table(results, title="Results")
if displacy_path: if displacy_path:
docs = [ex.doc for ex in dev_dataset] docs = [ex.predicted for ex in dev_dataset]
render_deps = "parser" in nlp.meta.get("pipeline", []) render_deps = "parser" in nlp.meta.get("pipeline", [])
render_ents = "ner" in nlp.meta.get("pipeline", []) render_ents = "ner" in nlp.meta.get("pipeline", [])
render_parses( render_parses(