mirror of https://github.com/explosion/spaCy.git
Move generation of parses out of with blocks
This commit is contained in:
parent
ec0beccaf1
commit
f35a8221d8
|
@ -84,12 +84,12 @@ def evaluate(
|
|||
def render_parses(docs, output_path, model_name="", limit=250, deps=True, ents=True):
|
||||
docs[0].user_data["title"] = model_name
|
||||
if ents:
|
||||
html = displacy.render(docs[:limit], style="ent", page=True)
|
||||
with (output_path / "entities.html").open("w") as file_:
|
||||
html = displacy.render(docs[:limit], style="ent", page=True)
|
||||
file_.write(html)
|
||||
if deps:
|
||||
html = displacy.render(
|
||||
docs[:limit], style="dep", page=True, options={"compact": True}
|
||||
)
|
||||
with (output_path / "parses.html").open("w") as file_:
|
||||
html = displacy.render(
|
||||
docs[:limit], style="dep", page=True, options={"compact": True}
|
||||
)
|
||||
file_.write(html)
|
||||
|
|
Loading…
Reference in New Issue