>>> from nltk.tag.stanford import NERTagger
>>> st = NERTagger('stanford-ner-2014-06-16/classifiers/english.all.3class.distsim.crf.ser.gz','stanford-ner-2014-06-16/stanford-ner.jar')
>>> st.tag('John has refused the offer from Facebook. He will work for Google'.split())
=========================================================================== NLTK was unable to find the java file! Use software specific configuration paramaters or set the JAVAHOME environment variable. ===========================================================================
stackoverflow上提出的解决办法,调用前在环境变量中加入javahome
>>> import os
>>> os.environ['JAVAHOME'] = "C:/Program Files/Java/jdk1.8.0_31/bin"