'Scores ngrams using Pearson\'s chi-square as in Manning and Schutze
5.3.3.'

@classmethod
def chi_sq(cls, *marginals):

    cont = cls._contingency(*marginals)
    exps = cls._expected_values(cont)
    return sum(((((obs - exp) ** 2) / (exp + _SMALL)) for (obs, exp) in zip(cont, exps)))
