0

I have trained a FastText model in Python and saved the files into a folder. These are the contents of the folder:

fasttext.model
fasttext.model.trainables.syn1neg.npy
fasttext.model.trainables.vectors_ngrams_lockf.npy
fasttext.model.trainables.vectors_vocab_lockf.npy
fasttext.model.wv.vectors.npy
fasttext.model.wv.vectors_ngrams.npy
fasttext.model.wv.vectors_vocab.npy

How can I load the model in MATLAB and extract the word embeddings of certain words? This is what we do in Python:

from gensim.models.fasttext import FastText
model = FastText.load(fasttext.model)
vector = model.wv[word]

Is there a similar thing in MATLAB? How can I get the word embeddings generated by a FastText model in Python in MATLAB and work with them?

1 Answers1

0

Use the trainWordEmbedding and readWordEmbedding function

Train and test your word embedding: "emb" Word embedding doesn't need bag of words. It just needs tokenized document ("cleanDoc").

emb = trainWordEmbedding(cleanDoc, "Dimension",100)
writeWordEmbedding(emb,"medEmb.vec");

List down the vocabulary in the embedding: emb.Vocabulary