
fastText
A library for learning word vectors and classifying text, built for speed.
- Stars
- 26.5k
- Forks
- 4.8k
- Licence
- MIT
- Language
- HTML
- Last update
- 2.6 years ago
- Type
- Library
This repository is archived and no longer maintained.
What it is
fastText is a library from Facebook Research for turning words and sentences into numeric vectors, and for training fast text classifiers such as sentiment analysis. It includes a command-line tool and Python bindings. The project is archived, so it is no longer actively developed, though the README still describes how to build and use it.
- Train a word-vector model from a plain UTF-8 text file with the skipgram command
- Compute vectors for words the model has never seen, using print-word-vectors
- Train a supervised text classifier on labeled sentences and predict labels for new text
- Compress a trained classifier into a smaller .ftz file with quantize
- Compute vectors for whole sentences or paragraphs with print-sentence-vectors
Great for
- Developers who need a fast, lightweight text classifier on a CPU
- Teams working with many languages who want pretrained word vectors for 157 languages
- People who need vectors for rare or misspelled words, since the model uses character n-grams
- Researchers reproducing results from the fastText papers
Not ideal for
- Teams starting a new project today, because the repository is archived and no longer maintained
- People who need state-of-the-art accuracy on complex language tasks, since the README presents it as a fast, simple approach rather than a large language model
- Non-programmers, since setup requires building from source with a compiler or Python tooling
How to get it
- 1
Clone and build from source
You'll need: C++11-capable compiler such as g++ 4.7.2+ or clang 3.3+ · make · Python 2.7 or 3.4+ with NumPy and SciPy and pybind11 (for Python bindings)
Clone the repository
git clone https://github.com/facebookresearch/fastText.gitBuild the CLI with make
makeInstall the Python bindings
pip install . - 2
Run it
- Build the fasttext binary with make from the source directory
- Train word vectors with ./fasttext skipgram -input data.txt -output model
- Or train a classifier with ./fasttext supervised -input train.txt -output model
- Test the classifier with ./fasttext test model.bin test.txt k
- Predict labels for new text with ./fasttext predict model.bin test.txt k
- 3
Get the most out of it
- Use the pretrained word vectors on the official site if you do not want to train your own
- Run quantize on a supervised model to shrink its memory footprint into a .ftz file
- Check the cheatsheet of one-liners linked from the README for common commands
- Read the python/README.md for details on the Python interface
Downloads
Strengths
- Fast training and prediction, as the project name and README emphasize
- Handles out-of-vocabulary words through character n-grams
- Includes a command-line tool, a C++ library, and Python bindings
Trade-offs
- The repository is archived, so it may not receive fixes or updates
- Building requires a C++11-capable compiler and make, and the Python install is built from the cloned source
- The README does not describe accuracy benchmarks in the truncated text, so performance claims are hard to verify here
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| fastText (this) | 26.5k | Library | intermediate | 2.6 years ago | Developers who need a fast, lightweight text classifier on a CPU |
| spaCy | 34k | Library | intermediate | 10 days ago | Python developers building text-processing features into an application |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.