whichlang
Library Listed
A blazingly fast and lightweight language detection library for Rust.
- Downloads
- 52,880
- Dependents
- 11
- Stars
- 464
- Forks
- 27
- Contributors
- 6
- Commits
- 45
- Latest release
- 0.1.1 ·
About
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/short | 16.62 | 1.66 |
| whatlang/long | 62.00 | 9.42 |
| whichlang/short | 0.26 | 105.69 |
| whichlang/long | 5.21 | 112.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% |
Compatibility
- 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.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
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 |
|
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 daysdormancy: last activity 2026-03-30, 224 days ago, E = 365: activerot: oldest unanswered issue 1265 days (limit 270), no maintainer reply in 365 daysfeatured: 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
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption7 active dependents, 5 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 7 | crates.io database dump | Yes | |
| New dependents (365 days) | 5 | crates.io database dump | Yes | |
| Peak active dependents | 7 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 7 months ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-03-30 | GitHub repository | Yes | |
| Latest release | 2025-01-21 | crates.io database dump | Yes | |
| First release | 2023-05-10 | crates.io database dump | Yes | |
| Latest version | 0.1.1 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 1265 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 0 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution2 releases, 52,880 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 2 | crates.io database dump | Yes | |
| Downloads over 30 days | 52880 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository464 stars, 27 forks, 6 contributors, 45 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 464 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 27 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 6 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 45 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | No native code found | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 11 | crates.io database dump | No |
Corrections and review history
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.