'Returns the word relevance as tf * idf (0.0-1.0).
The relevance is a measure of how frequent the word occurs in the document,
compared to its frequency in other documents in the model.
If the document is not incorporated in a model, simply returns tf weight.'

def term_frequency_inverse_document_frequency(self, word, weight=TFIDF):

    if ((self.model is not None) and (weight == TFIDF)):
        idf = self.model.idf(word)
        idf = (((idf is None) and 1) or idf)
        return (self.tf(word) * idf)
    return self.tf(word)
