whichlang

Library Listed

A blazingly fast and lightweight language detection library for Rust.

Checked · Sources

Downloads
52,880
Dependents
11
Stars
464
Forks
27
Contributors
6
Commits
45
Latest release
0.1.1 ·

About

From the project README ·

This is a language detection library, aiming for both precision and performance.

Why build this?

While building Quickwit, a search engine tailored for log and tracing data, we found ourselves needing a light, fast, and precise language detection library in Rust that works well with our high throughput requirement. The full story and how it works are detailed in this blog post.

Features

  • No dependency
  • Throughput above 100 MB/s for short and long strings.
  • Good accuracy (99.5% on my validation dataset, but it really depends on the size of your input.)
  • Supported languages: Arabic, Dutch, English, French, German, Hindi, Italian, Japanese, Korean, Mandarin, Portuguese, Russian, Spanish, Swedish, Turkish, and Vietnamese.

How does it work?

It uses a multiclass logistic regression model over:

  • 2, 3, 4-grams of letters on ASCII
  • codepoint / 128
  • a slightly smarter projection of codepoints over a given class.

We use the hashing trick and project these features over a space of size 4_096.

The logistic regression is trained in the python notebook attached, and used to generate weight.rs.

Read the full README

Comparison with Whatlang

The following compares the throughput using the simple benchmark found in this repository and the accuracy using whatlang-accuracy-benchmark benchmark. Overall, Whichlang is about 10x faster and slightly more accurate than Whatlang.

Throughput

To generate the throughput benchmark, we ported the benchmark available in this repository. Please, check this repository to see our changes.

Processing Time (µs)Throughput (MiB/s)
whatlang/short16.621.66
whatlang/long62.009.42
whichlang/short0.26105.69
whichlang/long5.21112.31
Accuracy

To generate the accuracy benchmark, we have changed the whatlang-accuracy-benchmark to add support for Whichlang. Given that Whatlang supports more languages, we have used its FilterList feature to restrict its analysis to only languages that are supported in Whichlang. We also use the trigram method in Whatlang. Please, check this repository to see our changes.

Crate: Whatlang
AVG: 91.69%

| LANG       | AVG    | <= 20   | 21-50  | 51-100 | > 100   |
|------------|--------|---------|--------|--------|---------|
| Arabic     | 99.68% | 99.51%  | 99.64% | 99.83% | 99.76%  |
| Mandarin   | 96.09% | 97.54%  | 96.92% | 95.45% | 94.43%  |
| German     | 88.57% | 70.00%  | 88.53% | 96.61% | 99.16%  |
| English    | 85.99% | 57.82%  | 88.37% | 97.97% | 99.78%  |
| French     | 90.88% | 72.84%  | 92.51% | 98.54% | 99.65%  |
| Hindi      | 99.80% | 100.00% | 99.83% | 99.78% | 99.61%  |
| Italian    | 87.75% | 66.67%  | 87.74% | 97.04% | 99.54%  |
| Japanese   | 94.37% | 93.97%  | 96.04% | 94.30% | 93.18%  |
| Korean     | 99.17% | 98.88%  | 99.69% | 99.44% | 98.66%  |
| Dutch      | 89.68% | 72.13%  | 89.78% | 97.40% | 99.40%  |
| Portuguese | 88.08% | 72.90%  | 85.76% | 95.22% | 98.44%  |
| Russian    | 99.98% | 100.00% | 99.96% | 99.98% | 100.00% |
| Spanish    | 82.91% | 55.45%  | 82.24% | 94.85% | 99.10%  |
| Swedish    | 84.16% | 58.33%  | 83.78% | 96.35% | 98.18%  |
| Turkish    | 86.73% | 61.01%  | 88.94% | 97.32% | 99.63%  |
| Vietnamese | 93.23% | 82.84%  | 92.96% | 97.88% | 99.24%  |
| AVG        | 91.69% | 78.74%  | 92.04% | 97.37% | 98.61%  |
Crate: Whichlang
AVG: 97.03%

| LANG       | AVG     | <= 20   | 21-50   | 51-100  | > 100   |
|------------|---------|---------|---------|---------|---------|
| Arabic     | 100.00% | 100.00% | 100.00% | 100.00% | 100.00% |
| Mandarin   | 98.65%  | 98.69%  | 98.48%  | 98.55%  | 98.87%  |
| German     | 94.20%  | 80.00%  | 97.47%  | 99.49%  | 99.84%  |
| English    | 97.15%  | 91.84%  | 97.25%  | 99.57%  | 99.93%  |
| French     | 97.59%  | 93.83%  | 97.61%  | 99.20%  | 99.71%  |
| Hindi      | 100.00% | 100.00% | 100.00% | 100.00% | 100.00% |
| Italian    | 97.20%  | 93.06%  | 97.33%  | 98.85%  | 99.57%  |
| Japanese   | 94.92%  | 88.95%  | 95.14%  | 97.74%  | 97.85%  |
| Korean     | 99.83%  | 99.44%  | 99.98%  | 99.97%  | 99.94%  |
| Dutch      | 97.08%  | 92.84%  | 96.98%  | 98.91%  | 99.60%  |
| Portuguese | 94.07%  | 83.87%  | 94.89%  | 98.18%  | 99.36%  |
| Russian    | 99.92%  | 99.69%  | 99.99%  | 100.00% | 100.00% |
| Spanish    | 92.12%  | 76.36%  | 93.78%  | 98.65%  | 99.70%  |
| Swedish    | 95.37%  | 90.28%  | 94.94%  | 97.76%  | 98.51%  |
| Turkish    | 95.51%  | 88.24%  | 98.11%  | 98.38%  | 97.33%  |
| Vietnamese | 98.79%  | 96.57%  | 98.87%  | 99.77%  | 99.96%  |
| AVG        | 97.03%  | 92.10%  | 97.55%  | 99.06%  | 99.39%  |
Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
None found
  • No native code found
Python bindings
No Python binding crate found
License
MIT

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

whichlang beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
whichlang This page Listed

A blazingly fast and lightweight language detection library for Rust.

52,880 downloads over 30 days 11 464 0.1.1 GPU support unknown No native code found MIT
tiktoken-rs Featured

Library for encoding and decoding with the tiktoken library in Rust

3,939,182 downloads over 30 days 449 410 0.12.1 GPU support unknown No native code found MIT
whatlang-rs Featured

Fast and lightweight language identification library for Rust.

882,019 downloads over 30 days 74 1,087 0.18.0 GPU support unknown No native code found MIT
lingua-rs Featured

An accurate natural language detection library, suitable for short text and mixed-language text

Python bindings

286,625 downloads over 30 days 22 1,152 1.8.0 GPU support unknown Binds native code: cld2-sys (feature accuracy-reports) Apache-2.0
sentencex Listed

Sentence segmentation library with wide language support optimized for speed and utility.

114,914 downloads over 30 days 1 145 0.1.34 GPU support unknown No native code found MIT
splintr Listed

Tokenizer for Rust and Python: pure Rust by default, with 18 bundled vocabularies and four backends covering BPE, SentencePiece and WordPiece. Its output matches Hugging Face tokenizers id for id on 14 model families, including GPT-2, Qwen, Whisper, T5 and BERT.

Python bindings

8,204 downloads over 30 days 7 63 0.22.2 GPU support unknown Binds native code: pcre2-sys (feature pcre2) MIT
semchunk-rs Listed Dormant

A fast and lightweight Rust library for splitting text into semantically meaningful chunks.

864 downloads over 30 days 3 4 0.1.1 GPU support unknown Binds native code: torch-sys (feature rust-bert) MIT
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

  • It has 7 active dependents and 5 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 464 stars, 27 forks and 6 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.

What else the check found

  • The last activity is on 30 Mar 2026, 224 days ago. The rules expect an update within 365 days. Dormancy rule
  • The oldest outside issue waits 1265 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 0.1.1 base 300, capped at 2 releases = 100, doubled for 52880 downloads per month, raised to the 365-day floor: E = 365 days
  • dormancy: last activity 2026-03-30, 224 days ago, E = 365: active
  • rot: oldest unanswered issue 1265 days (limit 270), no maintainer reply in 365 days
  • featured: not featured: active_users 7 < 11 and new_adopters 5 < 9 and repository route stars 464 (needs 4539), forks 27 (needs 434), contributors 6 (needs 79)
  • listed: listed: no archive, new or featured rule applies

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption7 active dependents, 5 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents7crates.io database dumpYes
New dependents (365 days)5crates.io database dumpYes
Peak active dependents7crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 7 months ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-03-30GitHub repositoryYes
Latest release2025-01-21crates.io database dumpYes
First release2023-05-10crates.io database dumpYes
Latest version0.1.1crates.io database dumpYes
Days the oldest outside issue waits for a reply1265GitHub repositoryYes
Maintainer replies over 365 days0GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution2 releases, 52,880 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases2crates.io database dumpYes
Downloads over 30 days52880crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository464 stars, 27 forks, 6 contributors, 45 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars464GitHub repositoryYes — one part of the repository route
GitHub forks27GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account6GitHub contributorsYes — one part of the repository route
Commits on the default branch45GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseMITcrates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly11crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.