Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Introduction to Natural Language Processing in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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(____)
Code bewerken en uitvoeren