始める無料で始める

Pink Floydの楽曲の類似度を計算する

この最後の演習では、イギリスのバンド Pink Floyd の3曲、'High Hopes'、'Hey You'、'Mother' の歌詞が与えられています。これらの歌詞はそれぞれ hopesheymother として利用できます。

あなたのタスクは、motherhopes、そして motherhey のペアごとの類似度を計算することです。

この演習はコースの一部です

Pythonで学ぶNLPの特徴量エンジニアリング

コースを見る

演習の手順

  • motherhopesheyDocオブジェクトを作成します。
  • 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.____(____))
コードを編集して実行