'Returns the score for a given bigram using the given scoring
function.  Following Church and Hanks (1990), counts are scaled by
a factor of 1/(window_size - 1).'

def score_ngram(self, score_fn, w1, w2):

    n_all = self.N
    n_ii = (self.ngram_fd[(w1, w2)] / (self.window_size - 1.0))
    if (not n_ii):
        return
    n_ix = self.word_fd[w1]
    n_xi = self.word_fd[w2]
    return score_fn(n_ii, (n_ix, n_xi), n_all)
