gensim logo

gensim
gensim tagline

Get Expert Help From The Gensim Authors

Consulting in Machine Learning & NLP

Corporate trainings in Data Science, NLP and Deep Learning

models.wrappers.fasttext – Wrapper for FastText implementation from Facebook

models.wrappers.fasttext – Wrapper for FastText implementation from Facebook

Warning

Deprecated since version 3.2.0: Use gensim.models.fasttext instead.

Python wrapper around word representation learning from FastText, a library for efficient learning of word representations and sentence classification [1].

This module allows training a word embedding from a training corpus with the additional ability to obtain word vectors for out-of-vocabulary words, using the fastText C implementation.

The wrapped model can NOT be updated with new documents for online training – use gensim’s Word2Vec for that.

Example:

>>> from gensim.models.wrappers import FastText
>>> model = FastText.train('/Users/kofola/fastText/fasttext', corpus_file='text8')
>>> print(model['forests'])  # prints vector for given out-of-vocabulary word
1

https://github.com/facebookresearch/fastText#enriching-word-vectors-with-subword-information