問題文
問題の概要
most_similar *1 を使います。topn で上位何件を返すかを指定できます。デフォルトで topn=10 となっていますが、分かりやすさのために敢えて明示的に指定しています。
from gensim.models import KeyedVectors model = KeyedVectors.load_word2vec_format('ch07/GoogleNews-vectors-negative300.bin', binary=True) result = model.most_similar(positive=['United_States'], topn=10) print(result)