尝试使用自动更正模块时出错

时间:2015-12-12 16:51:25

标签: python python-3.x autocorrect

我的Python版本在win32上为3.5。我用

成功安装了自动更正模块
pip install autocorrect

但是,当我尝试导入它时

from autocorrect import spell

我收到以下错误:

Traceback (most recent call last):

File "<ipython-input-6-09b8d81ac4fb>", line 1, in <module>
runfile('C:/Users/AERizzo/Documents/Python Scripts/BagOfWords_v3.py',
    wdir='C:/Users/AERizzo/Documents/Python Scripts')

File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
execfile(filename, namespace)

File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 85, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

File "C:/Users/AERizzo/Documents/Python Scripts/BagOfWords_v3.py", line 11, in <module>
from autocorrect import spell

File "C:\Anaconda3\lib\site-packages\autocorrect\__init__.py", line 16, in <module>
from autocorrect.nlp_parser import NLP_COUNTS

File "C:\Anaconda3\lib\site-packages\autocorrect\nlp_parser.py", line 26, in <module>
NLP_WORDS, NLP_COUNTS = parse('big.txt')

File "C:\Anaconda3\lib\site-packages\autocorrect\nlp_parser.py", line 20, in parse
words = words_from_archive(lang_sample, include_dups=True)

File "C:\Anaconda3\lib\site-packages\autocorrect\utils.py", line 28, in words_from_archive
with closing(t.extractfile(tar_path)) as f:

File "C:\Anaconda3\lib\tarfile.py", line 2066, in extractfile
tarinfo = self.getmember(member)

File "C:\Anaconda3\lib\tarfile.py", line 1743, in getmember
raise KeyError("filename %r not found" % name)

KeyError: "filename 'words\\\\big.txt' not found"

我查看了utils.py,它似乎是从一个文件words.bz2中读取的。我打开了bz2存档,big.txt文件确实存在。可能是什么问题?

0 个答案:

没有答案