textblob 使用中问题

简介: (1)找不到数据文件错误 Errors more Resource u'tokenizers/punkt/english.pickle' not found. Please use the NLTK Downloader to obtain the resource: >>> nltk.download() Searched in:

(1)找不到数据文件错误

Errors more 
Resource u'tokenizers/punkt/english.pickle' not found.  Please
    use the NLTK Downloader to obtain the resource:  >>>
    nltk.download()
    Searched in:
    - '/var/www/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
    - u'



Traceback (most recent call last):
  File "/var/www/CSCE-470-Anime-Recommender/py/app.py", line 40, in <module>
    cl = NaiveBayesClassifier(Functions.classify(UserData))
  File "/usr/local/lib/python2.7/dist-packages/textblob/classifiers.py", line 192, in __init__
    self.train_features = [(self.extract_features(d), c) for d, c in self.train_set]
  File "/usr/local/lib/python2.7/dist-packages/textblob/classifiers.py", line 169, in extract_features
    return self.feature_extractor(text, self.train_set)
  File "/usr/local/lib/python2.7/dist-packages/textblob/classifiers.py", line 81, in basic_extractor
    word_features = _get_words_from_dataset(train_set)
  File "/usr/local/lib/python2.7/dist-packages/textblob/classifiers.py", line 63, in _get_words_from_dataset
    return set(all_words)
  File "/usr/local/lib/python2.7/dist-packages/textblob/classifiers.py", line 62, in <genexpr>
    all_words = chain.from_iterable(tokenize(words) for words, _ in dataset)
  File "/usr/local/lib/python2.7/dist-packages/textblob/classifiers.py", line 59, in tokenize
    return word_tokenize(words, include_punc=False)
  File "/usr/local/lib/python2.7/dist-packages/textblob/tokenizers.py", line 72, in word_tokenize
    for sentence in sent_tokenize(text))
  File "/usr/local/lib/python2.7/dist-packages/textblob/base.py", line 64, in itokenize
    return (t for t in self.tokenize(text, *args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/textblob/decorators.py", line 38, in decorated
    raise MissingCorpusError()
MissingCorpusError: 
Looks like you are missing some required data for this feature.

To download the necessary data, simply run

    python -m textblob.download_corpora

or use the NLTK downloader to download the missing data: http://nltk.org/data.html
If this doesn't fix the problem, file an issue at https://github.com/sloria/TextBlob/issues.

 我本地没有taggers/averaged_perceptron_tagger/averaged_perceptron_tagger.pickle这个文件,打开本地nltk_data,发现还真是,只有下载了

解决方法:使用nltk下载

nltk.download()


下载过程中会有个弹窗,要自己选择下载的文件,在Models里第一个averaged_perceptron_tagger,然后点击下载,如果网络环境比较好的话,很快就可以下载完成了。

(2)翻译问题

    textblob 的翻译程序在 /usr/lib/python2.7/site-packages/textblob/translate.py

他主要是使用了google的翻译,代码中的链接为

url = "http://translate.google.com/translate_a/t"

所以,国内是访问不料这个网址的,所以就翻译不了


目录
打赏
0
0
0
0
138
分享
相关文章
|
10月前
一劳永逸的方法解决:LNK1168无法打开 xxx.exe 进行写入 报错问题
一劳永逸的方法解决:LNK1168无法打开 xxx.exe 进行写入 报错问题
994 2
《GraalVM:Java AI 应用性能与启动速度的优化利器》
在人工智能蓬勃发展的今天,Java 在 AI 领域占据重要地位,但也面临性能和启动速度的挑战。GraalVM 以其高效的即时编译、内存管理优化、多语言融合及提前编译等特性,显著提升了 Java AI 应用的执行效率和启动速度,助力开发者打造更高效的 AI 解决方案。通过优化类加载机制和垃圾回收,GraalVM 实现了更快的响应和更稳定的运行,适用于图像识别、智能风控、云原生服务等多种场景。
成功解决ProxyError: Conda cannot proceed due to an error in your proxy configuration.Check for typos an
成功解决ProxyError: Conda cannot proceed due to an error in your proxy configuration.Check for typos an
成功解决ProxyError: Conda cannot proceed due to an error in your proxy configuration.Check for typos an
使用深度学习模型进行情感分析!!!
本文介绍了如何使用深度学习模型进行中文情感分析。首先导入了必要的库,包括`transformers`、`pandas`、`jieba`和`re`。然后定义了一个`SentimentAnalysis`类,用于处理数据、加载真实标签和评估模型准确性。在主函数中,使用预训练的情感分析模型对处理后的数据进行预测,并计算模型的准确性。
195 0
|
6月前
|
Blob格式转json格式,拿到后端返回的json数据
文章介绍了如何将后端返回的Blob格式数据转换为JSON格式,并处理文件下载和错误提示。
351 0
Blob格式转json格式,拿到后端返回的json数据
使用Python实现深度学习模型:自动编码器(Autoencoder)
使用Python实现深度学习模型:自动编码器(Autoencoder)
349 0
一张图说清楚:大模型“大”在哪?ChatGLM模型结构详解
一张图说清楚:大模型“大”在哪?ChatGLM模型结构详解
393 2
使用Python实现深度学习模型:智能心理诊断与辅助
【8月更文挑战第9天】 使用Python实现深度学习模型:智能心理诊断与辅助
97 2
Python 教程之 Pandas(6)—— DataFrame 中的转换函数
Python 教程之 Pandas(6)—— DataFrame 中的转换函数
304 0
Python 教程之 Pandas(6)—— DataFrame 中的转换函数
LoRA及其变体概述:LoRA, DoRA, AdaLoRA, Delta-LoRA
LoRA可以说是针对特定任务高效训练大型语言模型的重大突破。它被广泛应用于许多应用中。在本文中,我们将解释LoRA本身的基本概念,然后介绍一些以不同的方式改进LoRA的功能的变体,包括LoRA+、VeRA、LoRA- fa、LoRA-drop、AdaLoRA、DoRA和Delta-LoRA。
709 2

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等