zoukankan      html  css  js  c++  java
  • python nltk nltk_data 离线安装,chatterbot

    离线数据包下载地址: https://codeload.github.com/nltk/nltk_data/zip/gh-pages
    unzip nltk_data-gh-pages.zip
    cd nltk_data-gh-pages/packages/
    cp -r * ~/nltk_data
    批量解压 数据包:  ls *.zip | xargs -n1 unzip -o -P infected
    
    chatterbot  每次启动执行 nltk_download_corpus  
    [nltk_data] Error loading stopwords: <urlopen error [Errno 60]
    [nltk_data]     Operation timed out>
    [nltk_data] Error loading averaged_perceptron_tagger: <urlopen error
    [nltk_data]     [Errno 60] Operation timed out>
    
    chatterbot里stopwords在nltk-data目录下、上述下载方式stopwords在nltk-data下的corpora目录
    
    由于目录结构问题导致每次下载 stopwords、wordnet、averaged_perceptron_tagger、vader_lexicon
    
    而网络问题导致各种timed out
    
    修改文件 .pyenv/versions/3.7.4/lib/python3.7/site-packages/chatterbot/utils.py  
     
    
    def download_nltk_stopwords():
        """
        Download required NLTK stopwords corpus if it has not already been downloaded.
        """
        nltk_download_corpus('corpora/stopwords')
    
    def download_nltk_wordnet():
        """
        Download required NLTK corpora if they have not already been downloaded.
        """
        nltk_download_corpus('corpora/wordnet')
    
    def download_nltk_averaged_perceptron_tagger():
        """
        Download the NLTK averaged perceptron tagger that is required for this algorithm
        to run only if the corpora has not already been downloaded.
        """
        nltk_download_corpus('taggers/averaged_perceptron_tagger')
    
    def download_nltk_vader_lexicon():
        """
        Download the NLTK vader lexicon for sentiment analysis
        that is required for this algorithm to run.
        """
        nltk_download_corpus('sentiment/vader_lexicon')
  • 相关阅读:
    公交/地铁出行测试用例点
    python第一次作业
    jmeter之jsonpath断言
    jsonhandle与jsonpath extractor(json值提取插件)
    jmeter 插件之Dummy samper-----------------moke服务
    jmeter插件安装
    JMeter组件之Test Fragment
    jmeter连接MySQL构造大量并发测试数据
    某购物网站大量用户登录脚本
    jenkins+ant+jmeter接口测试自动化平台(带发送附件测试报告)
  • 原文地址:https://www.cnblogs.com/dockers/p/11414881.html
Copyright © 2011-2022 走看看