I was able to download and extract zip files to c:\nltk_data... however running a simple example of
import nltk
# from nltk.util import ngrams
text = "This is a test of ngrams"
tokenize = nltk.word_tokenize(text, 3)
print(tokenize)
bigrams = ngrams(tokenize, 2)
print(bigrams)
I get the following error. However, punkt is in c:\nltk_data\tokenizers\punkt... sigh sometimes the simplest things are difficult.
Any ideas?
Thanks,
Jeff
---
runfile('C:/Users/vandeje1/Documents/python/spyder/untitled7.py', wdir='C:/Users/vandeje1/Documents/python/spyder')
Traceback (most recent call last):
File "<ipython-input-1-0800495a64bc>", line 1, in <module>
runfile('C:/Users/vandeje1/Documents/python/spyder/untitled7.py', wdir='C:/Users/vandeje1/Documents/python/spyder')
File "C:\Users\vandeje1\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
execfile(filename, namespace)
File "C:\Users\vandeje1\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/vandeje1/Documents/python/spyder/untitled7.py", line 11, in <module>
tokenize = nltk.word_tokenize(text, 3)
File "C:\Users\vandeje1\AppData\Local\Continuum\anaconda3\lib\site-packages\nltk\tokenize\__init__.py", line 128, in word_tokenize
sentences = [text] if preserve_line else sent_tokenize(text, language)
File "C:\Users\vandeje1\AppData\Local\Continuum\anaconda3\lib\site-packages\nltk\tokenize\__init__.py", line 94, in sent_tokenize
tokenizer = load('tokenizers/punkt/{0}.pickle'.format(language))
File "C:\Users\vandeje1\AppData\Local\Continuum\anaconda3\lib\site-packages\nltk\data.py", line 836, in load
opened_resource = _open(resource_url)
File "C:\Users\vandeje1\AppData\Local\Continuum\anaconda3\lib\site-packages\nltk\data.py", line 954, in _open
return find(path_, path + ['']).open()
File "C:\Users\vandeje1\AppData\Local\Continuum\anaconda3\lib\site-packages\nltk\data.py", line 675, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************