Skip to content
Projects

messense/fasttext-rs has 71 GitHub stars and 14 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-15 22:07 UTC. Last push 2026-11-05.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
Update delayed
in 1 month
Update delayed

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

Rust implementation of fastText

Developer Tools

README.md

Original

fasttext-rs

CI codecov Crates.io docs.rs

Pure Rust implementation of fastText

Installation

Add it to your Cargo.toml:

[dependencies]
fasttext = "0.8"

Usage

Training a model

use fasttext::FastText;
use fasttext::args::{Args, ModelName};

let mut args = Args::default();
args.input = "data.txt".into();
args.model = ModelName::Supervised;
args.epoch = 25;
args.lr = 1.0;

let model = FastText::train(args).unwrap();
model.save_model("model.bin").unwrap();

Loading and predicting

use fasttext::FastText;

let model = FastText::load_model("model.bin").unwrap();
let predictions = model.predict("Which baking dish is best?", 3, 0.0);
for pred in &predictions {
    println!("{} {}", pred.label, pred.prob);
}

Nearest neighbors

use fasttext::FastText;

let model = FastText::load_model("model.bin").unwrap();
let neighbors = model.get_nn("king", 10);
for (score, word) in &neighbors {
    println!("{word}\t{score}");
}

CLI

A command-line tool compatible with the C++ fastText CLI is available behind the cli feature:

cargo install fasttext --features cli

It supports C++-style single-dash flags (e.g. -epoch 25) as well as standard double-dash flags (--epoch 25):

fasttext supervised -input data.txt -output model -epoch 25 -lr 1.0
fasttext predict model.bin test.txt
fasttext test model.bin test.txt
fasttext nn model.bin

License

This work is released under the MIT license. A copy of the license is provided in the LICENSE file.