My below code is not working.I wanted to draw the named entity in a tree form.Have provided the code with error screenshot
What IDE are you running this code in? Maybe try the command line?
I am running it in jupyter notebook
For me this works in Jupyter. Try these in order:
- replacing
nmedEnt.draw()
withdisplay(nmedEnt)
, - updating Jupyter,
- applying tricks from How could I inline nltk graph to jupyter notebook? · Issue #1765 · nltk/nltk · GitHub.
Thanks a lot Jean, It worked for me with this code “svgling.draw_tree(nmedEnt)”. But even in this case one thing that I saw was when the data in “nmedEnt” is huge,it did not show any output/error.The cell just simply ran.
Well, do you get a picture for a very short sentence like "Cats eat dogs.
? If not, there would be an infinite loop somewhere (post your code in this case). If yes, gradually add sentences and see where you can get (I am new to nltk
so I have no idea of an order of magnitude here).