1
こんにちはPythonの感情分類
from senti_classifier import senti_classifier
sentences = ['i love u']
pos_score, neg_score = senti_classifier.polarity_scores(sentences)
print pos_score, neg_score
、単一の文すなわちのため正常に動作します。しかしXLSファイルを使用して、次のように行われたときにすべてのレコードを分類するために、結果は正と負の両方のスコアに対して0.0である。 私を助けてください。
import openpyxl
from senti_classifier import senti_classifier
wb = openpyxl.load_workbook('sentiment2.xlsx')
sheet = wb.active
sheet.columns[0]
for cellObj in sheet.columns[0]:
sentences = cellObj.value
print(sentences)
pos_score, neg_score = senti_classifier.polarity_scores(sentences)
print pos_score, neg_score