Professional Documents
Culture Documents
Medical Manual
Medical Manual
Representations
We shall learn how to make a model learn Word Representations using FastText in Python by
training word vectors using Unsupervised Learning techniques.
Cython is a prerequisite to install fasttext. To install Cython, run the following command in
Terminal :
Input Data
But, please remember that, for any useful model to be trained, you may need lot of data corpus
w.r.t your use case, at least a billion words. Input could be given as a text file.
import fasttext
# CBOW model
model = fasttext.cbow('TrainingData.txt', 'model')
print model.words # list of words in dictionary
print model['machine'] # get the vector of the word 'machine'
Try Online
Running the above python program creates two files. One is model file (with .bin extension)
containing trained parameters and the other is vector file (with .vec extension) containing vector
representations of words in the training data file.