#NEWLINE# @ staticmethod #NEWLINE# def _dunning_log_likelihood( count_a , count_b , count_ab , N ) : #NEWLINE# #INDENT# '\n        A function that calculates the modified Dunning log-likelihood\n        ratio scores for abbreviation candidates.  The details of how\n        this works is available in the paper.\n        ' #NEWLINE# p1 = ( count_b / N ) #NEWLINE# p2 = 0.99 #NEWLINE# null_hypo = ( ( count_ab * math . log ( p1 ) ) + ( ( count_a - count_ab ) * math . log ( ( 1.0 - p1 ) ) ) ) #NEWLINE# alt_hypo = ( ( count_ab * math . log ( p2 ) ) + ( ( count_a - count_ab ) * math . log ( ( 1.0 - p2 ) ) ) ) #NEWLINE# likelihood = ( null_hypo - alt_hypo ) #NEWLINE# return ( ( - 2.0 ) * likelihood )