This is just a primitive “setup and use” snippet.
It is very easy to use the Jupyter Notebook with nbextensions for visualazing the tests of spaCy model. The displaCy Jupyter extension is a simple extension for Jupyter Notebook that lets you visualize a JSON-formatted dependency parse using the displaCy visualizer.
excerpt_separator:
pip install jupyter_contrib_nbextensions
jupyter nbextension install --user https://github.com/explosion/spacy-dev-resources/tree/master/jupyter-displacy
jupyter nbextension enable displacy
doc1 = nlp('Dependency tree parsing results can be visualized easily in a notebook.')
for token in doc1:
print(token.text, token.lemma_, token.pos_, token.tag_)
displacy.render(doc1, style='dep', jupyter=True)
See: SpaCy Visualizers