I have a trained customised fasttext model. I want to rewrite it into a customised transformer so I can fit it into sklearn pipeline as it only accepts transformer.
At the moment, I’m able to get the word vectors.
def name2vector(name=None): vec = [np.array(model.get_word_vector(w)) for w in name.lower().split(' ')] name_vec = np.sum(vec, axis=0) # If "name" is multiple words, sum the vectors return (name_vec)
The function returns vectors of the word I feed in. For example:
array([-0.01087821, 0.01030535, -0.01402427, 0.0310982 , 0.08786983, -0.00404521, -0.03286128, -0.00842709, 0.03934859, -0.02717219, 0.01151722, -0.03253938, -0.02435859, 0.03330994, -0.03696496], dtype=float32))
Hyperlink has been removed by a moderator