使用哈佛IV-4词典进行情感分析

问题描述 投票:0回答:1

我正尝试使用哈佛IV-4词典来计算情感。我成功安装了“ pysentiment”。我运行以下命令:

import pysentiment as ps
hiv4 = ps.HIV4()
tokens = hiv4.tokenize(text)  
score = hiv4.get_score(tokens)

我收到以下错误:

 Traceback (most recent call last):
  File "C:/Users/df/Desk Top/Finalazed/punctuation.py", line 274, in <module>
    hiv4 = ps.HIV4()
  File "C:\Users\df\AppData\Local\Programs\Python\Python37\lib\site-packages\pysentiment\base.py", line 55, in __init__
    self._tokenizer = Tokenizer()
  File "C:\Users\df\AppData\Local\Programs\Python\Python37\lib\site-packages\pysentiment\utils.py", line 36, in __init__
    self._stopset = self.get_stopset()
  File "C:\Users\df\AppData\Local\Programs\Python\Python37\lib\site-packages\pysentiment\utils.py", line 52, in get_stopset
    fin = open('%s/%s'%(STATIC_PATH, f), 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\df\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pysentiment\\static/Currencies.txt'

有人能告诉我为什么得到这个吗?谢谢。

sentiment-analysis
1个回答
1
投票

在给定路径中复制pysentiment文件夹。实际上pysentiment文件夹不包含静态子文件夹。您可以通过显示隐藏的文件夹“本地”来进行检查。

© www.soinside.com 2019 - 2024. All rights reserved.