命令行键入python -m nltk.downloader stopwords一般可以在C:\Users\Administrator\AppData\Roaming\nltk_data\corpora路径下找到stopwords的zip压缩文件,解压即可
  
   
    Resource
   
   
    stopwords
   
   not found.
   
    Please
   
   
    use
   
   the
   
    NLTK
   
   
    Downloader
   
   to
   
    obtain
   
   the
   
    resource
   
   :
  >>> import
   
    nltk
   
   >>>
   
    nltk
   
   .download('
   
    stopwords
   
   ')
Attempted to load corpora/
   
    stopwords
   
   Searched ...
  
  LookupError: 
**********************************************************************
  
   Resource
  
  'tokenizers/punkt/PY3/english.pickle' not found.
  
   Please
  
  
   use
  
  the
  
   NLTK
  
  
   Downloader
  
  to
  
   obtain
  
  the r...
  
   from
   
    nltk
   
   .corpus import
   
    stopwords
   
   stoplist =
   
    stopwords
   
   .words('english')
text = "this is just a test"
cleanwordlist = [word for word in text.lower().split() if word not in stoplist]
cleanwordlist
   
    
     心比天高,仗剑走天涯,保持热爱,奔赴向梦想!低调,谦虚,自律,反思,成长,还算是比较正能量的博主,公益免费传播……内心特别想在AI界做出一些可以推进历史进程影响力的东西(兴趣使然,有点小情怀,也有点使命感呀)……
    
   
   
    08-20
   
   
    安装
    
     NLTK
    
    可能出现的问题:
1. pip install ntlk
2. 如果遇到缺少
    
     stopwords
    
    报错如下:(http://johnlaudun.org/20130126-
    
     nltk
    
    -
    
     stopwords
    
    /)
LookupError:
**********************************************************************
   
   [
   
    nltk
   
   _data] Error loading
   
    stopwords
   
   : <urlopen error [Errno 11004]
[
   
    nltk
   
   _data]   getaddrinfo failed>
Traceback (most recent call last):
 File "C:\
   
    Use
   
   rs\Jack\anaconda3\envs\py36_tf17\lib\site-packages\
   
    nltk
   
   \corpu...
  
 
  
   回家前,把python自然语言处理的
   
    nltk
   
   _data打包到360云盘,然后共享给朋友们,省的大家像我一样浪费时间。一次性下载解压后即可使用。官方的
   
    nltk
   
   .download()老是下载失败。无数遍了。浪费了我很多很多时间。
打包下载(推荐):http://yunpan.cn/cgGUPFzF3spir (提取码:504e)
下载后放在python/
   
    nltk
   
   _data目录下即可.
>>> import
   
    nltk
   
   >>>
   
    nltk
   
   .download('
   
    stopwords
   
   ')
[
   
    nltk
   
   _data] Error loading
   
    stopwords
   
   : <urlopen error [WinError 10060]
[
   
    nltk
   
   _data]
  
  
   Python报错
   
    Resource
   
   punkt not found.
   
    Please
   
   
    use
   
   the
   
    NLTK
   
   
    Downloader
   
   to
   
    obtain
   
   the
   
    resource
   
   :
  
  
   这个报错是因为在使用Python
   
    NLTK
   
   (自然语言工具包)时缺少必要的语料库资源。你需要使用
   
    NLTK
   
   的
   
    Downloader
   
   来获取这个资源。具体操作步骤为:打开Python解释器,输入以下的命令:
import
   
    nltk
   
   
    nltk
   
   .download('punkt')
这个命令将会下载并安装所需要的资源。如果你安装的是conda,请在anaconda prompt中运行命令。