MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Introduction to Natural Language Processing in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Create a new TfidfModel using the corpus: tfidf
tfidf = ____

# Calculate the tfidf weights of doc: tfidf_weights
tfidf_weights = ____

# Print the first five weights
print(____)
Edit dan Jalankan Kode