【发布时间】:2014-09-28 14:08:45
【问题描述】:
我有这段代码,它应该将积极的语料库与主题文本进行比较。在我发现重复的文本没有被考虑之前,它做得很好。
文字:这是一部非常好的电影,太好了
肯定列表:好,更好等等。
脚本在以下实现中只算“好”一次:
readFile = open('test.txt','r').read()
readFileList = readFile.split('\n')
counter = 0
for eachNeg in negWords:
if eachNeg in readFile:
counter -= 1
print eachNeg
print counter
for eachPos in posWords:
if eachPos in readFile:
counter +=1
print eachPos
print counter
【问题讨论】:
标签: python python-2.7 nlp sentiment-analysis