2

我正在尝试这个很棒的 Python 情绪分析工具包,名为 Vader ( https://github.com/cjhutto/vaderSentiment#python-code-example )。但是,由于解码问题(?),我什至无法运行他们的示例。

我已经尝试了 .decode('utf-8'),但它仍然给了我这个错误代码:

Traceback (most recent call last):
  File "/Users/solari/Codes/EmotionalTwitter/vader.py", line 22, in 
<module>
    analyzer = SentimentIntensityAnalyzer()
  File "/usr/local/lib/python3.6/site-
packages/vaderSentiment/vaderSentiment.py", line 199, in __init__
    self.lexicon_full_filepath = f.read()
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/l
ib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6573: ordinal not in range(128)
[Finished in 0.5s with exit code 1]

为什么它抱怨这个“ascii 编解码器”?因为如果我正确阅读了他们的文档,无论如何这应该是 utf-8。另外,我使用的是 Python 3.6.2。

4

0 回答 0