Boris Orekhov's picture
2

Boris Orekhov

nevmenandr

AI & ML interests

Natural Language Processing, Poetry Generation, Linguistics, Low-resource languages

Recent Activity

updated a dataset about 1 month ago
nevmenandr/russian-old-orthography-ocr
updated a model about 1 month ago
nevmenandr/russian-old-orthography
updated a model about 2 months ago
nevmenandr/w2v-chess

Organizations

nevmenandr's activity

posted an update 4 months ago
view post
Post
2613
nevmenandr/w2v-chess

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()

biblically accurate angel
posted an update 5 months ago
posted an update 5 months ago
view post
Post
1311
nevmenandr/w2v-russian-tolstoy

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"])])


life by Tolstoy (w2v):

posted an update 6 months ago
view post
Post
1211
Playing with dhcloud/w2v-russian-19c-fiction-lemmas


import numpy as np
from gensim.models import Word2Vec
from sklearn.manifold import TSNE

modell = Word2Vec.load("w2vlemmas.model")
keys = ['Шекспир', 'Пушкин', 'Гоголь', 'матрос', 'кот', 'роман']
embedding_clusters = []
word_clusters = []
for word in keys:
    embeddings = []
    words = []
    for similar_word, _ in modell.wv.most_similar(word, topn=30):
        words.append(similar_word)
        embeddings.append(modell.wv[similar_word])
    embedding_clusters.append(embeddings)
    word_clusters.append(words)
tsne_model_en_2d = TSNE(perplexity=15, n_components=2, init='pca', n_iter=3500, random_state=32)
embedding_clusters = np.array(embedding_clusters)
n, m, k = embedding_clusters.shape
embeddings_en_2d = np.array(tsne_model_en_2d.fit_transform(embedding_clusters.reshape(n * m, k))).reshape(n, m, 2)

Novel is a different type of literature than Shakespeare and Pushkin