在NLTK中有一个nltk.download()函数来下载NLP套件附带的数据集。在
我应该在哪里保存从源下载的数据?在我将数据保存到正确的目录之后,在我可以从python代码调用之前,是否还有其他步骤?在
是否有下载20newsgroups数据集的示例?
我已经安装了sklearn并尝试了这个,但是我得到了一个IOError。很可能是因为我还没有从源代码下载数据集。在>>> from sklearn.datasets import fetch_20newsgroups
>>> fetch_20newsgroups(subset='train')
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/sklearn/datasets/twenty_newsgroups.py", line 207, in fetch_20newsgroups
cache_path=cache_path)
File "/usr/local/lib/python2.7/dist-packages/sklearn/datasets/twenty_newsgroups.py", line 89, in download_20newsgroups
tarfile.open(archive_path, "r:gz").extractall(path=target_dir)
File "/usr/lib/python2.7/tarfile.py", line 1678, in open
return func(name, filemod