NOTE: I am using Python 2.7 as part of Anaconda distribution. I hope this is not a problem for nltk 3.1.
I am trying to use nltk for NER as
import nl
i fixed!
u should indicate the full path of slf4j-api.jar in CLASSPATH
instead of add jar-path into system environment variable, u can do like this in code:
_CLASS_PATH = "."
if os.environ.get('CLASSPATH') is not None:
_CLASS_PATH = os.environ.get('CLASSPATH')
os.environ['CLASSPATH'] = _CLASS_PATH + ';F:\Python\Lib\slf4j\slf4j-api-1.7.13.jar'
important, in nltk/*/stanford.py will reset the classpath like this:
stdout, stderr = java(cmd, classpath=self._stanford_jar, stdout=PIPE, stderr=PIPE)
eg. \Python34\Lib\site-packages\nltk\tokenize\stanford.py line:90
u can fix it like this:
_CLASS_PATH = "."
if os.environ.get('CLASSPATH') is not None:
_CLASS_PATH = os.environ.get('CLASSPATH')
stdout, stderr = java(cmd, classpath=(self._stanford_jar, _CLASS_PATH), stdout=PIPE, stderr=PIPE)