'Smoothing method 5:
The matched counts for similar values of n should be similar. To a
calculate the n-gram matched count, it averages the nâ1, n and n+1 gram
matched counts.'

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

    m = {}
    p_n_plus1 = (p_n + [modified_precision(references, hypothesis, 5)])
    m[(-1)] = (p_n[0] + 1)
    for (i, p_i) in enumerate(p_n):
        p_n[i] = (((m[(i - 1)] + p_i) + p_n_plus1[(i + 1)]) / 3)
        m[i] = p_n[i]
    return p_n
