BaşlayınÜcretsiz Başlayın

tf-idf vectors for TED talks

In this exercise, you have been given a corpus ted which contains the transcripts of 500 TED Talks. Your task is to generate the tf-idf vectors for these talks.

In a later lesson, we will use these vectors to generate recommendations of similar talks based on the transcript.

Bu egzersiz

Feature Engineering for NLP in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import TfidfVectorizer from sklearn.
  • Create a TfidfVectorizer object. Name it vectorizer.
  • Generate tfidf_matrix for ted using the fit_transform() method.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import TfidfVectorizer
from ____ import ____

# Create TfidfVectorizer object
____

# Generate matrix of word vectors
tfidf_matrix = vectorizer.____(____)

# Print the shape of tfidf_matrix
print(tfidf_matrix.shape)
Kodu Düzenle ve Çalıştır