LoginSignup
12
11

More than 5 years have passed since last update.

word2vecでword ○○ not in vocabularyになった場合の対処

Posted at

対処

焦らず例外処理を書くだけで良い.

important_word[]は単語が格納されている配列です.

コード

sample.py
for i in range(len(important_word)):
    try:
        print(model.most_similar(important_word[i]))
    except KeyError as error:
        print(error)
12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11