def score(count_bigram, count1, count2, n_words):
if n_words <= count1 or n_words <= count2:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>N = n_words<EOL>c12 = count_bigram<EOL>c1 = count1<EOL>c2 = count2<EOL>p = c2 / N<EOL>p1 = c12 / c1<EOL>p2 = (c2 - c12) / (N - c1)<EOL>score = (l(c12, c1, p) + l(c2 - c12, N - c1, p)<EOL>- l(c12, c1, p1) - l(c2 - c12, N - c1, p2))<EOL>return -<NUM_LIT:2> * score<EOL>
Collocation score