'Smoothing method 6:
Interpolates the maximum likelihood estimate of the precision *p_n* with
a prior estimate *pi0*. The prior is estimated by assuming that the ratio
between pn and pnâ1 will be the same as that between pnâ1 and pnâ2; from
Gao and He (2013) Training MRF-Based Phrase Translation Models using
Gradient Ascent. In NAACL.'

def method6(self, p_n, references, hypothesis, hyp_len, *args, **kwargs):

    assert p_n[2], 'This    smoothing    method    requires    non-zero    precision    for    bigrams.'
    for (i, p_i) in enumerate(p_n):
        if (i in [0, 1]):
            continue
        else:
            pi0 = (0 if (p_n[(i - 2)] == 0) else ((p_n[(i - 1)] ** 2) / p_n[(i - 2)]))
            m = p_i.numerator
            l = sum((1 for _ in ngrams(hypothesis, (i + 1))))
            p_n[i] = ((m + (self.alpha * pi0)) / (l + self.alpha))
    return p_n
