我想把句子分为正面和负面。我已应用以下代码:
import openpyxl
from senti_classifier import senti_classifier
file_content = open('amazon_kindle.txt')
for lines in file_content:
pos_score,neg_score = senti_classifier.polarity_scores(lines)
print(pos_score)
print(neg_score)
我发现了以下错误:
Traceback (most recent call last):
File "G:/Setups/Python/classifier.py", line 2, in <module>
from senti_classifier import senti_classifier
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
File "G:\Setups\Python\lib\site-packages\sentiment_classifier-0.7-py3.6.egg\senti_classifier\senti_classifier.py", line 227, in <module>
senti_pickle = resource_stream('senti_classifier', 'data/SentiWn.p')
File "G:\Setups\Python\lib\site-packages\pkg_resources\__init__.py", line 1209, in resource_stream
self, resource_name
File "G:\Setups\Python\lib\site-packages\pkg_resources\__init__.py", line 1454, in get_resource_stream
return io.BytesIO(self.get_resource_string(manager, resource_name))
File "G:\Setups\Python\lib\site-packages\pkg_resources\__init__.py", line 1457, in get_resource_string
return self._get(self._fn(self.module_path, resource_name))
File "G:\Setups\Python\lib\site-packages\pkg_resources\__init__.py", line 1530, in _get
return self.loader.get_data(path)
OSError: [Errno 0] Error: 'senti_classifier\\data\\SentiWn.p'