https://github.com/hanzhichao2000/pysentiment是我试图为我工作的代码,因为我想评估一段文字是正面的还是负面的。
我真的不明白为什么它不起作用,如果有人可以提出任何建议,我会很高兴。 (可能有必要知道我在学校PC上运行它,我需要它才能工作,因此python(2.7)的路径不像往常那么简单,因此我下载文件夹而不是做pip安装或类似的将它们添加到Lib文件夹中)
我发布了整个错误代码,因为我不知道什么是最相关的。谢谢!
import pysentiment as ps
lm = ps.LM()
Traceback (most recent call last):
File "<ipython-input-16-cd6a13354c8a>", line 1, in <module>
lm = ps.LM()
File "pysentiment\base.py", line 57, in __init__
self.init_dict()
File "pysentiment\lm.py", line 20, in init_dict
terms = data['Word'][data[category] > 0]
File "C:\ProgramData\App-V\6F9A7389-FA64-4C13-A3B9-539B0D5EBBE5\8405BD12-8798-436E-AEE5-B79704BB086F\Root\VFS\AppVPackageDrive\Python27\lib\site-packages\pandas\core\frame.py", line 1797, in __getitem__
return self._getitem_column(key)
File "C:\ProgramData\App-V\6F9A7389-FA64-4C13-A3B9-539B0D5EBBE5\8405BD12-8798-436E-AEE5-B79704BB086F\Root\VFS\AppVPackageDrive\Python27\lib\site-packages\pandas\core\frame.py", line 1804, in _getitem_column
return self._get_item_cache(key)
File "C:\ProgramData\App-V\6F9A7389-FA64-4C13-A3B9-539B0D5EBBE5\8405BD12-8798-436E-AEE5-B79704BB086F\Root\VFS\AppVPackageDrive\Python27\lib\site-packages\pandas\core\generic.py", line 1084, in _get_item_cache
values = self._data.get(item)
File "C:\ProgramData\App-V\6F9A7389-FA64-4C13-A3B9-539B0D5EBBE5\8405BD12-8798-436E-AEE5-B79704BB086F\Root\VFS\AppVPackageDrive\Python27\lib\site-packages\pandas\core\internals.py", line 2851, in get
loc = self.items.get_loc(item)
File "C:\ProgramData\App-V\6F9A7389-FA64-4C13-A3B9-539B0D5EBBE5\8405BD12-8798-436E-AEE5-B79704BB086F\Root\VFS\AppVPackageDrive\Python27\lib\site-packages\pandas\core\index.py", line 1572, in get_loc
return self._engine.get_loc(_values_from_object(key))
File "pandas\index.pyx", line 134, in pandas.index.IndexEngine.get_loc (pandas\index.c:3824)
File "pandas\index.pyx", line 154, in pandas.index.IndexEngine.get_loc (pandas\index.c:3704)
File "pandas\hashtable.pyx", line 686, in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:12280)
File "pandas\hashtable.pyx", line 694, in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:12231)
KeyError: 'Word'