nevmenandr/russian-old-orthography-ocr
Viewer
•
Updated
•
249k
•
158
import gensim
from sklearn.decomposition import PCA
import matplotlib
import matplotlib.pyplot as plt
model = gensim.models.Word2Vec.load('white_moves.model')
dict_moves = model.wv.vocab
dict_moves_appr = {}
for k in dict_moves:
if not k.startswith('->'):
continue
dict_moves_appr[k] = dict_moves[k]
X = model[model.wv.vocab]
pca = PCA(n_components=2)
result = pca.fit_transform(X)
fig, ax = plt.subplots()
ax.plot(Y[:, 0], Y[:, 1], 'o')
ax.set_title('White moves')
lab = list(dict_moves_appr)
for i, lb in enumerate(lab):
plt.annotate(lb, xy=(Y[i, 0], Y[i, 1]))
plt.show()
<div style="min-height:494px"><script type="text/javascript" defer src="https://datawrapper.dwcdn.net/q3waH/embed.js?v=2" charset="utf-8"></script><noscript><img src="https://datawrapper.dwcdn.net/q3waH/full.png" alt="" /></noscript></div>
import gensim
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set_style("darkgrid")
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
modelLNT2 = Word2Vec.load("cbow_300_10.model")
# skip some code... for full version see model's card
tsnescatterplot(modelLNT2, 'жизнь_S', [i[0] for i in modelLNT2.wv.most_similar(negative=["жизнь_S"])])