'Returns the inverse document frequency for the given word or feature.
Returns None if the word is not in the model, or if there are no documents in the model.
Using the natural logarithm:
idf = log(1/df)
The more occurences of the word, the lower its idf weight (log() makes it grow slowly).'

def inverse_document_frequency(self, word, base=2.71828):

    df = self.df(word)
    if (df == 0.0):
        return None
    if (df == 1.0):
        return 0.0
    return log((1.0 / df), base)
