From d900c7e01dd18a7092bfeb17166ad759cde8d403 Mon Sep 17 00:00:00 2001 From: higepi Date: Sun, 25 Sep 2022 23:30:57 +0200 Subject: [PATCH] word2vec sim --- wordvec.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 wordvec.py diff --git a/wordvec.py b/wordvec.py new file mode 100644 index 0000000..1d83cf6 --- /dev/null +++ b/wordvec.py @@ -0,0 +1,11 @@ +import gensim.downloader as api +wv = api.load('word2vec-google-news-300') + +# Affichage de quelques mots du vocabulaire +# for index, word in enumerate(wv.index_to_key): +# if index == 10: +# break +# print(f"word #{index}/{len(wv.index_to_key)} is {word}") + +print(wv.most_similar(positive=['car'], topn=5)) +print(wv.most_similar(positive=['voiture'], topn=5)) \ No newline at end of file