python nltk模块错误

时间:2018-07-28 08:45:54

标签: python nltk

import nltk

text = "Python is an interpreted high-level programming language for general-purpose programming. Created by Guido van Rossum and first released in 1991."

sentences = nltk.sent_tokenize(text)

print(len(sentences))

错误:

============== RESTART: E:/......./ex1.py ==============

Traceback (most recent call last):
  File "E:/......../ex1.py", line 3, in <module>
    sentences = nltk.sent_tokenize(text)

  File "C:\Program Files\Python36\lib\site-packages\nltk\tokenize\__init__.py", line 94, in sent_tokenize
    tokenizer = load('tokenizers/punkt/{0}.pickle'.format(language))

  File "C:\Program Files\Python36\lib\site-packages\nltk\data.py", line 836, in load
    opened_resource = _open(resource_url)

  File "C:\Program Files\Python36\lib\site-packages\nltk\data.py", line 954, in _open
    return find(path_, path + ['']).open()

  File "C:\Program Files\Python36\lib\site-packages\nltk\data.py", line 675, in find
    raise LookupError(resource_not_found)

**********************************************************************

0 个答案:

没有答案