開始使用免費開始

計算 Pink Floyd 歌曲的相似度

在最後這個練習中,提供了英國樂團 Pink Floyd 的三首歌詞:'High Hopes'、'Hey You' 和 'Mother'。這些歌詞分別以 hopesheymother 提供。

你的任務是計算 motherhopes、以及 motherhey 之間的成對相似度。

本練習屬於課程

Python 中文本特徵工程

檢視課程

練習說明

  • motherhopeshey 建立 Doc 物件。
  • 計算 motherhopes 之間的相似度。
  • 計算 motherhey 之間的相似度。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# 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.____(____))
編輯並執行程式碼