From cc66f47893a60596145cd62cba501d0d1410779e Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Mon, 19 Aug 2019 11:53:34 +0200 Subject: [PATCH] Make enabling/disabling jupyter mode more explicit (#4144) * make enabling/disabling jupyter mode more explicit * markup fix --- website/docs/usage/visualizers.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/website/docs/usage/visualizers.md b/website/docs/usage/visualizers.md index 16cdc94fc..6172d2f48 100644 --- a/website/docs/usage/visualizers.md +++ b/website/docs/usage/visualizers.md @@ -201,11 +201,14 @@ doc2 = nlp(LONG_NEWS_ARTICLE) displacy.render(doc2, style="ent") ``` -> #### Enabling or disabling Jupyter mode -> -> To explicitly enable or disable "Jupyter mode", you can use the jupyter` -> keyword argument – e.g. to return raw HTML in a notebook, or to force Jupyter -> rendering if auto-detection fails. + + +To explicitly enable or disable "Jupyter mode", you can use the `jupyter` +keyword argument – e.g. to return raw HTML in a notebook, or to force Jupyter +rendering if auto-detection fails. + + + ![displaCy visualizer in a Jupyter notebook](../images/displacy_jupyter.jpg) @@ -281,7 +284,7 @@ nlp = spacy.load("en_core_web_sm") sentences = [u"This is an example.", u"This is another one."] for sent in sentences: doc = nlp(sent) - svg = displacy.render(doc, style="dep") + svg = displacy.render(doc, style="dep", jupyter=False) file_name = '-'.join([w.text for w in doc if not w.is_punct]) + ".svg" output_path = Path("/images/" + file_name) output_path.open("w", encoding="utf-8").write(svg)