import math


def mutual_information(co_oc, oi, oj, n):
    """
    :param co_oc: Number of co occurrences of the terms oi and oj in the corpus
    :param oi: Number of occurrences of the term oi in the corpus
    :param oj: Number of occurrences of the term oi in the corpus
    :param n: Total number of words in the corpus
    :return:
    """
    e = (oi * oj)/n
    return math.log2(co_oc/e)