Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- testPosTotal = math.log(PPos)
- testNegTotal = math.log(PNeg)
- for word in AllTestWords:
- if word in posDict:
- testPosTotal += math.log(posDict[word])
- if word in negDict:
- testNegTotal += math.log(negDict[word])
- print 'Total positive =',testPosTotal
- print 'Total negative =',testNegTotal
- if testPosTotal > testNegTotal:
- print 'More chance of being positive'
- print (testPosTotal/(testPosTotal+testNegTotal))*100, '%'
- else:
- print 'More chance of being negative'
- print (testNegTotal/(testPosTotal+testNegTotal))*100, '%'
- print '\n'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement