2016-10-19 6 views
0

Windows(64ビット)およびnltk-3.2.1用にAnaconda3-4.2.0をインストールしました。私はJupyterノートにNLTKファイルのエラー

`para = "Hello World. It's good to see you. Thanks for buying this book." 
import nltk.data tokenizer = nltk.data.load('tokenizers/punkt/PY3/english.pickle') tokenizer.tokenize(para)' 

を次のコードを実行していますが、私は次のエラーを取得しています:

'OSError         Traceback (most recent call last) 
<ipython-input-1-a87e01558cc4> in <module>() 
     1 para = "Hello World. It's good to see you. Thanks for buying this book." 
     2 import nltk.data 
----> 3 tokenizer = nltk.data.load('tokenizers/punkt/PY3/english.pickle') 
     4 tokenizer.tokenize(para) 

C:\Anaconda3\lib\site-packages\nltk\data.py in load(resource_url, format, cache, verbose, logic_parser, fstruct_reader, encoding) 
    799 
    800  # Load the resource. 
--> 801  opened_resource = _open(resource_url) 
    802 
    803  if format == 'raw': 

C:\Anaconda3\lib\site-packages\nltk\data.py in _open(resource_url) 
    917 
    918  if protocol is None or protocol.lower() == 'nltk': 
--> 919   return find(path_, path + ['']).open() 
    920  elif protocol.lower() == 'file': 
    921   # urllib might not use mode='rb', so handle this one ourselves: 

C:\Anaconda3\lib\site-packages\nltk\data.py in find(resource_name, paths) 
    607       return GzipFileSystemPathPointer(p) 
    608      else: 
--> 609       return FileSystemPathPointer(p) 
    610    else: 
    611     p = os.path.join(path_, url2pathname(zipfile)) 

C:\Anaconda3\lib\site-packages\nltk\compat.py in _decorator(*args, **kwargs) 
    559  def _decorator(*args, **kwargs): 
    560   args = (args[0], add_py3_data(args[1])) + args[2:] 
--> 561   return init_func(*args, **kwargs) 
    562  return wraps(init_func)(_decorator) 
    563 

C:\Anaconda3\lib\site-packages\nltk\data.py in __init__(self, _path) 
    298   _path = os.path.abspath(_path) 
    299   if not os.path.exists(_path): 
--> 300    raise IOError('No such file or directory: %r' % _path) 
    301   self._path = _path 
    302 

OSError: No such file or directory: 'C:\\nltk_data\\tokenizers\\punkt\\PY3\\PY3\\english.pickle'` 

私はNLTKでpunktwordトークナイザをダウンロードしています。なぜこのエラーが表示されますか?答えを教えてください。

答えて

0

tokenizers/punkt/PY3/english.pickleファイルが存在しないようです。あなたはそれをチェックする必要があります。

NLTKピクルスファイル使用ダウン​​ロード機能をダウンロードすることができます。

import nltk 
nltk.download() 
+0

トークナイザ/ PUNKT/PY3/english.pickleファイルがあります。私はNLTKダウンローダからPunkt Tokenizer Modelsをダウンロードしました。 C:\ nltk_dataにインストールされています。パスはC:\ nltk_data \ tokenizers/punkt/PY3/english.pickle –

+0

あなたのコードに完全なパスを書きますが、まだエラーがありますか? – ictxiangxin

+0

コードで完全なパスを指定すると、次のエラーが表示されます。 –