diff --git a/lessons/5-NLP/14-Embeddings/EmbeddingsTF.ipynb b/lessons/5-NLP/14-Embeddings/EmbeddingsTF.ipynb index e11b248b..6556058e 100644 --- a/lessons/5-NLP/14-Embeddings/EmbeddingsTF.ipynb +++ b/lessons/5-NLP/14-Embeddings/EmbeddingsTF.ipynb @@ -292,6 +292,16 @@ "> **Note:** When you first create word vectors, downloading them can take some time!" ] }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "import gensim.downloader as api\n", + "w2v = api.load('word2vec-google-news-300')" + ] + }, { "cell_type": "code", "execution_count": 12, @@ -409,7 +419,7 @@ "d = np.sum((w2v.vectors-qvec)**2,axis=1)\n", "min_idx = np.argmin(d)\n", "# find the corresponding word\n", - "w2v.index2word[min_idx]" + "w2v.index_to_key[min_idx]" ] }, {