Merge pull request #208 from mclift/restore-gensim-import

Restore missing code block & update deprecated method call
This commit is contained in:
Pikachú 2023-07-05 14:32:29 +03:00 committed by GitHub
commit 63b722e934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -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]"
]
},
{