Reputation: 135
Here when I run this particular code
import os
import nltk
import nltk.corpus
print(os.listdir(nltk.data.find("corpora"))) `
I get
IndexError Traceback (most recent call
last)
IndexError: list index out of range
Upvotes: 0
Views: 1236
Reputation: 142661
I run this code without error.
If there is problem with data then you should get this error also with two lines:
import nltk
print(nltk.data.find("corpora"))
As I remember nltk
at start needs to download data from server - and this can be the problem.
import nltk
nltk.download()
See doc: Installing NLTK Data
Upvotes: 2