mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-14 18:22:27 +03:00
Open file as utf-8 (closes #4138)
This commit is contained in:
parent
f35a8221d8
commit
89f2b87266
|
@ -85,11 +85,11 @@ def render_parses(docs, output_path, model_name="", limit=250, deps=True, ents=T
|
||||||
docs[0].user_data["title"] = model_name
|
docs[0].user_data["title"] = model_name
|
||||||
if ents:
|
if ents:
|
||||||
html = displacy.render(docs[:limit], style="ent", page=True)
|
html = displacy.render(docs[:limit], style="ent", page=True)
|
||||||
with (output_path / "entities.html").open("w") as file_:
|
with (output_path / "entities.html").open("w", encoding="utf8") as file_:
|
||||||
file_.write(html)
|
file_.write(html)
|
||||||
if deps:
|
if deps:
|
||||||
html = displacy.render(
|
html = displacy.render(
|
||||||
docs[:limit], style="dep", page=True, options={"compact": True}
|
docs[:limit], style="dep", page=True, options={"compact": True}
|
||||||
)
|
)
|
||||||
with (output_path / "parses.html").open("w") as file_:
|
with (output_path / "parses.html").open("w", encoding="utf8") as file_:
|
||||||
file_.write(html)
|
file_.write(html)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user