Commit 848a0cc9 authored by Percedal's avatar Percedal
Browse files

method assoc sens <-> def

parent 1e5ca88d
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
def wsd(sens_vec, def_vec):
sens_vec: numpy.ndarray
Shape (n_sens, n_features)
def_vec: numpy.ndarray
Shape (n_def, n_features)
Shape (n_sens,)
Vecteur où pour chaque element 'n' à la position 's',
la 'n'-ième définition est la plus similaire au sens 's'
sims = cosine_similarity(sens_vec, def_vec) #Shape (n_sens, n_def)
return np.argmax(sims, axis=1) #Shape (n_sens,)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment