Session Ready
Exercise

Tf-idf with Wikipedia

Now it's your turn to determine new significant terms for your corpus by applying gensim's tf-idf. You will again have access to the same corpus and dictionary objects you created in the previous exercises - dictionary, corpus, and doc. Will tf-idf make for more interesting results on the document level?

TfidfModel has been imported for you from gensim.models.tfidfmodel.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Initialize a new TfidfModel called tfidf using corpus.
  • Use doc to calculate the weights. You can do this by passing [doc] to tfidf.
  • Print the first five term ids with weights.