I am trying to use NLTK interface for Stanford NER in the python enviornment, nltk.tag.stanford.NERTagger
.
from nltk.tag.stanford import NERTagger
st = NERTagger('/usr/share/stanford-ner/classifiers/all.3class.distsim.crf.ser.gz',
'/usr/share/stanford-ner/stanford-ner.jar')
st.tag('Rami Eid is studying at Stony Brook University in NY'.split())
I am supposed to get the output:
[('Rami', 'PERSON'), ('Eid', 'PERSON'), ('is', 'O'), ('studying', 'O'),
('at', 'O'), ('Stony', 'ORGANIZATION'), ('Brook', 'ORGANIZATION'),
('University', 'ORGANIZATION'), ('in', 'O'), ('NY', 'LOCATION')]
I have installed NLTK according the procedure described in the NLTK website. However, I can not find /usr/share/stanford-ner at all. Where and how do I find the whole package and install it in my directory.
One has to download the Stanford package independent of the NLTK download, put it in the place the path indicates and change the directory name in the path described in the NLTK document to whatever name one wants to use for the directory. It would have been nice if the NLTK documentation would state this explicitly.
Although this is a link only answer, it will resolve the OP's question.
For Windows: https://gist.github.com/alvations/0ed8641d7d2e1941b9f9
For Linux: https://gist.github.com/alvations/e1df0ba227e542955a8a
EDITED
But do note that this is not an eternal solution and since Stanford NLP tools and NLTK changes more than 2-3 times a year, please check the https://github.com/nltk/nltk/wiki/Installing-Third-Party-Software for latest setup instructions for NLTK API to Stanford tools.
Solutions above are posted on 17.03.2016
It might be easier to look at the more recent interfaces to Stanford CoreNLP for python which are available here: http://nlp.stanford.edu/software/corenlp.shtml
Just thought it would be worth mentioning that the import line is now: