In [1]:
#remmeber to pip install -r requirements.txt
import gensim
from gensim.models import word2vec
#load the model
model = word2vec.Word2Vec.load('latinvec.model')
In [2]:
#top five most similar words, all lowercase
model.most_similar_cosmul(positive='caesar')
Out[2]:
In [4]:
# how similar are two terms?
# bot iulius and julius appear, I don't know how to fix that.
model.similarity('augustus','iulius')
Out[4]:
In [15]:
#you can give several positive values an several negative ones
#the cosmul is usually a better result but there's another operation as well
#just pass an array of strings positive = ['','',''] and negative=['','']
model.most_similar_cosmul(positive=['imperator','romanum'])
Out[15]:
In [37]:
model.most_similar_cosmul(positive=['claudius','nero'])
Out[37]:
In [ ]: