MulaiMulai sekarang secara gratis

Computing similarity of Pink Floyd songs

In this final exercise, you have been given lyrics of three songs by the British band Pink Floyd, namely 'High Hopes', 'Hey You' and 'Mother'. The lyrics to these songs are available as hopes, hey and mother respectively.

Your task is to compute the pairwise similarity between mother and hopes, and mother and hey.

Latihan ini adalah bagian dari kursus

Feature Engineering for NLP in Python

Lihat Kursus

Petunjuk latihan

  • Create Doc objects for mother, hopes and hey.
  • Compute the similarity between mother and hopes.
  • Compute the similarity between mother and hey.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Create Doc objects
mother_doc = nlp(____)
hopes_doc = nlp(____)
hey_doc = nlp(hey)

# Print similarity between mother and hopes
print(mother_doc.____(hopes_doc))

# Print similarity between mother and hey
print(mother_doc.____(____))
Edit dan Jalankan Kode