For Matplotlib plots in iPython/Jupyter you can make the notebook plot plots inline with
%matplotlib inline
How can one do the same for NLTK draw() for trees? Here is the documentation http://www.nltk.org/api/nltk.draw.html
For Matplotlib plots in iPython/Jupyter you can make the notebook plot plots inline with
%matplotlib inline
How can one do the same for NLTK draw() for trees? Here is the documentation http://www.nltk.org/api/nltk.draw.html
Based on this answer:
Little slow, but does the job. If you're doing it remotely, don't forget to run your ssh session with
-X
key (likessh -X user@server.com
) so that Tk could initialize itself (no display name and no $DISPLAY environment variable
-kind of error)UPD: it seems like last versions of jupyter and nltk work nicely together, so you can just do
IPython.core.display.display(tree)
to get a nice-looking tree-render embedded into the output.2019 Update:
This runs on Jupyter Notebook:
Requirements: