python Lookup Error

Hello,

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()))

Open in new window

$ 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'
**********************************************************************

Open in new window

LVL 6
xRalfAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mish33Commented:
As error says: Resource 'tokenizers/punkt/english.pickle' not found.

You need to place it in one of the listed dirs.
xRalfAuthor Commented:
When
I write
nltk.download('tokenizers/punkt/english.pickle')
it writes error
/usr/local/lib/python2.6/dist-packages/nltk-2.0b9-py2.6.egg/nltk/__init__.py:588: DeprecationWarning: object.__new__() takes no parameters
[nltk_data] Error loading tokenizers/punkt/english.pickle: 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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xRalfAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.