FastText.Net 0.1.1

dotnet add package FastText.Net --version 0.1.1
                    
NuGet\Install-Package FastText.Net -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FastText.Net" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FastText.Net" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="FastText.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FastText.Net --version 0.1.1
                    
#r "nuget: FastText.Net, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FastText.Net@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FastText.Net&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=FastText.Net&version=0.1.1
                    
Install as a Cake Tool

FastText.Net

A managed, dependency-free C# port of Facebook fastText inference, focused on text/language classification. Load a pretrained supervised model (such as lid.176.ftz for language identification) and classify text without shipping any native binaries.

Unofficial. This is an independent, community port of the now-archived fastText project. It is not affiliated with or endorsed by Meta / Facebook. "fastText" is a trademark of its respective owner.

Only the prediction path is ported (model loading + predict); training is not included.

Features

  • Pure C# (net10.0), no native dependency, no P/Invoke.
  • Reads the standard fastText binary model format, including quantized .ftz models (product quantization) and hierarchical-softmax / softmax / sigmoid losses.
  • Byte-exact tokenization, FNV-1a hashing, and subword n-grams — results match the reference implementation (verified against the official Python fasttext package).
  • SIMD-accelerated linear algebra via System.Numerics.Tensors (TensorPrimitives).
  • Allocation-light prediction hot path (pooled buffers, thread-local state).

Installation

dotnet add package FastText.Net

Usage

using FastTextNet;

var model = FastTextModel.Load("lid.176.ftz");

foreach (var p in model.Predict("Bonjour, comment allez-vous?", k: 3))
{
    Console.WriteLine($"{p.Label}: {p.Probability:P2}");
}
// __label__fr: 95.79%
// __label__en:  1.89%
// __label__nl:  0.26%

FastTextModel is immutable after loading and safe to share across threads.

Getting a model

Pretrained language-identification models are published by Facebook (CC BY-SA 3.0) and are not bundled with this package:

Any supervised fastText model in the standard binary format will load.

License

MIT. Derived from fastText (MIT, © Facebook, Inc.). See the project repository for full attribution and third-party notices: https://github.com/ericstj/FastText.Net

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 0 6/8/2026
0.1.0 50 6/7/2026