memoize inverse_document_frequency in TfIdfModel