def word_probabilities(counts, total_spams, total_non_spams, k=0.5):
 return [(w, ((spam + k) / (total_spams + (2 * k))), ((non_spam + k) / (total_non_spams + (2 * k)))) for (w, (spam, non_spam)) in counts.iteritems()]

def word_probabilities ( counts , total_spams , total_non_spams , k = 0.5 ) : return [ ( w , ( ( spam + k ) / ( total_spams + ( 2 * k ) ) ) , ( ( non_spam + k ) / ( total_non_spams + ( 2 * k ) ) ) ) for ( w , ( spam , non_spam ) ) in counts . iteritems ( ) ]
turn the word_counts into a list of triplets w .