import math


def compute_idf(word, documents):
    """
    compute the idf for a single word
    """
    num_occurs = 0
    for document in documents:
        if(word in documents[document]):
            num_occurs += 1

    return math.log(len(documents)/num_occurs)