windows - Python 3 nltk.data.load error -
i'm trying load english.pickle sentence tokenization. windows 7, python 3.4
file followed path exists(tokenizers/punkt/py3/english.pickle).
here code:
import nltk.data tokenizer = nltk.data.load('tokenizers/punkt/py3/english.pickle')
here error:
oserror: no such file or directory: 'c:\\python\\nltk_data\\tokenizers\\punkt\\py3\\py3\\english.pickle'
how fix?
the problem \\py3
doubled in path. nltk.data.load()
method adds /py3
path if called python 3.
so should work if load tokenizer (removing /py3
string):
import nltk tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
nltk allow possibility of programs run python 2 , 3.
Comments
Post a Comment