Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. testPosTotal = math.log(PPos)
  2. testNegTotal = math.log(PNeg)
  3.  
  4. for word in AllTestWords:
  5. if word in posDict:
  6. testPosTotal += math.log(posDict[word])
  7. if word in negDict:
  8. testNegTotal += math.log(negDict[word])
  9.  
  10.  
  11. print 'Total positive =',testPosTotal
  12. print 'Total negative =',testNegTotal
  13.  
  14. if testPosTotal > testNegTotal:
  15. print 'More chance of being positive'
  16. print (testPosTotal/(testPosTotal+testNegTotal))*100, '%'
  17. else:
  18. print 'More chance of being negative'
  19. print (testNegTotal/(testPosTotal+testNegTotal))*100, '%'
  20. print '\n'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement