MulaiMulai sekarang secara gratis

Exploring word relationships with embeddings

Word embeddings capture the meanings of words based on their usage in large text datasets. By placing similar words closer together in a continuous vector space, they allow models to recognize context and semantic relationships that more basic methods can't capture. Now You'll work with embeddings to explore these kinds of word relationships firsthand.

The glove-wiki-gigaword-50 word embedding model has been successfully loaded and is ready for use through the variable model_glove_wiki.

Latihan ini adalah bagian dari kursus

Natural Language Processing (NLP) in Python

Lihat Kursus

Petunjuk latihan

  • Compute the similarity score between "king" and "queen".
  • Get the top 10 most similar words to "computer".

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Compute similarity between "king" and "queen"
similarity_score = model_glove_wiki.____

print(similarity_score)

# Get top 10 most similar words to "computer"
similar_words = model_glove_wiki.____

print(similar_words)
Edit dan Jalankan Kode