xRalf
asked on
python Lookup Error
Hello,
Could you help me to solve this error message? Code and error are attached.
thank you
Could you help me to solve this error message? Code and error are attached.
thank you
import nltk.data
text = "Punkt knows that the periods in Mr. Smith and Johann S. Bach do not mark sentence boundaries. And sometimes sentences can start with non-capitalize words. i is a good variable name."
tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
print '\n-----\n'.join(tokenizer.tokenize(text.strip()))
$ python nltkexample.py
Traceback (most recent call last):
File "nltkexample.py", line 5, in <module>
tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
File "/usr/local/lib/python2.6/dist-packages/nltk-2.0b9-py2.6.egg/nltk/data.py", line 594, in load
resource_val = pickle.load(_open(resource_url))
File "/usr/local/lib/python2.6/dist-packages/nltk-2.0b9-py2.6.egg/nltk/data.py", line 673, in _open
return find(path).open()
File "/usr/local/lib/python2.6/dist-packages/nltk-2.0b9-py2.6.egg/nltk/data.py", line 455, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource 'tokenizers/punkt/english.pickle' not found. Please
use the NLTK Downloader to obtain the resource: >>>
nltk.download().
Searched in:
- '/home/xralf/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
**********************************************************************
ASKER
When
I write
nltk.download('tokenizers/ punkt/engl ish.pickle ')
it writes error
/usr/local/lib/python2.6/d ist-packag es/nltk-2. 0b9-py2.6. egg/nltk/_ _init__.py :588: DeprecationWarning: object.__new__() takes no parameters
[nltk_data] Error loading tokenizers/punkt/english.p ickle: Package
[nltk_data] 'tokenizers/punkt/english. pickle' not found in index
False
Should I use it another way? I don't know how to get the missing things. That's why I ask.
I write
nltk.download('tokenizers/
it writes error
/usr/local/lib/python2.6/d
[nltk_data] Error loading tokenizers/punkt/english.p
[nltk_data] 'tokenizers/punkt/english.
False
Should I use it another way? I don't know how to get the missing things. That's why I ask.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks I found there similar discussion which showed me link to the files that were needed to download and I've done it rather manually.
You need to place it in one of the listed dirs.