import math


def compute_IDF(doc_info):
    """
    idf = ln(total number of docs/number of docs with term in it)
    """
    number_of_docs = len(doc_info)
    idf_table = {}

    for idx, doc in enumerate(doc_info):
        for word in doc['freq_dict']:
            if word not in idf_table:
                idf_table[word] = 1
            else:
                idf_table[word] += 1

    for word in idf_table.keys():
        idf_table[word] = math.log(number_of_docs/idf_table[word])

    return idf_table