How to install and invoke Stanford NERTagger?

后端 未结 5 841
轮回少年
轮回少年 2020-12-06 19:12

I am trying to use NLTK interface for Stanford NER in the python enviornment, nltk.tag.stanford.NERTagger.

from nltk.t         


        
相关标签:
5条回答
  • 2020-12-06 19:47
    from nltk.tag.stanford import StanfordNERTagger
    st = StanfordNERTagger('/Users/mahendrabilagi/Desktop/stanford-ner-2017-06-09/classifiers/english.all.3class.distsim.crf.ser.gz',
               '/Users/mahendrabilagi/Desktop/stanford-ner-2017-06-09/stanford-ner.jar')
    print st.tag('Rami Eid is studying at Stony Brook University in Bengaluru'.split())
    
    0 讨论(0)
  • 2020-12-06 19:49

    Just thought it would be worth mentioning that the import line is now:

    from nltk.tag.stanford import StanfordNERTagger
    
    0 讨论(0)
  • 2020-12-06 19:49

    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

    0 讨论(0)
  • 2020-12-06 19:54

    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

    0 讨论(0)
  • 2020-12-06 19:55

    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.

    0 讨论(0)
提交回复
热议问题