nlprule
Library Listed Dormant
A fast, low-resource Natural Language Processing and Error Correction library.
- Downloads
- 8,412
- Dependents
- 6
- Stars
- 679
- Forks
- 46
- Contributors
- 6
- Commits
- 368
- Latest release
- 0.6.4 ·
About
A fast, low-resource Natural Language Processing and Error Correction library written in Rust. nlprule implements a rule- and lookup-based approach to NLP using resources from LanguageTool.
Python Usage
Install: pip install nlprule
Use:
from nlprule import Tokenizer, Rules
tokenizer = Tokenizer.load("en")
rules = Rules.load("en", tokenizer)
rules.correct("He wants that you send him an email.")
# returns: 'He wants you to send him an email.'
rules.correct("I can due his homework.")
# returns: 'I can do his homework.'
for s in rules.suggest("She was not been here since Monday."):
print(s.start, s.end, s.replacements, s.source, s.message)
# prints:
# 4 16 ['was not', 'has not been'] WAS_BEEN.1 Did you mean was not or has not been?
Read the full README
for sentence in tokenizer.pipe("A brief example is shown."):
for token in sentence:
print(
repr(token.text).ljust(10),
repr(token.span).ljust(10),
repr(token.tags).ljust(24),
repr(token.lemmas).ljust(24),
repr(token.chunks).ljust(24),
)
# prints:
# 'A' (0, 1) ['DT'] ['A', 'a'] ['B-NP-singular']
# 'brief' (2, 7) ['JJ'] ['brief'] ['I-NP-singular']
# 'example' (8, 15) ['NN:UN'] ['example'] ['E-NP-singular']
# 'is' (16, 18) ['VBZ'] ['be', 'is'] ['B-VP']
# 'shown' (19, 24) ['VBN'] ['show', 'shown'] ['I-VP']
# '.' (24, 25) ['.', 'PCT', 'SENT_END'] ['.'] ['O']
Rust Usage
Recommended setup:
Cargo.toml
[dependencies]
nlprule = "<version>"
[build-dependencies]
nlprule-build = "<version>" # must be the same as the nlprule version!
build.rs
fn main() -> Result<(), nlprule_build::Error> {
println!("cargo:rerun-if-changed=build.rs");
nlprule_build::BinaryBuilder::new(
&["en"],
std::env::var("OUT_DIR").expect("OUT_DIR is set when build.rs is running"),
)
.build()?
.validate()
}
src/main.rs
use nlprule::{Rules, Tokenizer, tokenizer_filename, rules_filename};
fn main() {
let mut tokenizer_bytes: &'static [u8] = include_bytes!(concat!(
env!("OUT_DIR"),
"/",
tokenizer_filename!("en")
));
let mut rules_bytes: &'static [u8] = include_bytes!(concat!(
env!("OUT_DIR"),
"/",
rules_filename!("en")
));
let tokenizer = Tokenizer::from_reader(&mut tokenizer_bytes).expect("tokenizer binary is valid");
let rules = Rules::from_reader(&mut rules_bytes).expect("rules binary is valid");
assert_eq!(
rules.correct("She was not been here since Monday.", &tokenizer),
String::from("She was not here since Monday.")
);
}
nlprule and nlprule-build versions are kept in sync.
Main features
- Rule-based Grammatical Error Correction through multiple thousand rules.
- A text processing pipeline doing sentence segmentation, part-of-speech tagging, lemmatization, chunking and disambiguation.
- Support for English, German and Spanish.
- Spellchecking. (in progress)
Goals
- A single place to apply spellchecking and grammatical error correction for a downstream task.
- Fast, low-resource NLP suited for running:
- as a pre- / postprocessing step for more sophisticated (i. e. ML) approaches.
- in the background of another application with low overhead.
- client-side in the browser via WebAssembly.
- 100% Rust code and dependencies.
Comparison to LanguageTool
| |Disambiguation rules| | |Grammar rules| | LT version | nlprule time | LanguageTool time | |
|---|---|---|---|---|---|
| English | 843 (100%) | 3725 (~ 85%) | 5.2 | 1 | 1.7 - 2.0 |
| German | 486 (100%) | 2970 (~ 90%) | 5.2 | 1 | 2.4 - 2.8 |
| Spanish | Experimental support. Not fully tested yet. |
See the benchmark issue for details.
Projects using nlprule
- prosemd: a proofreading and linting language server for markdown files with VSCode integration.
- cargo-spellcheck: a tool to check all your Rust documentation for spelling and grammar mistakes.
Please submit a PR to add your project!
Acknowledgements
All credit for the resources used in nlprule goes to LanguageTool who have made a Herculean effort to create high-quality resources for Grammatical Error Correction and broader NLP.
License
nlprule is licensed under the MIT license or Apache-2.0 license, at your option.
The nlprule binaries (*.bin) are derived from LanguageTool v5.2 and licensed under the LGPLv2.1 license. nlprule statically and dynamically links to these binaries. Under LGPLv2.1 §6(a) this does not have any implications on the license of nlprule itself.
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- Optional
- Binds native code: onig_sys (feature regex-onig)
- Python bindings
- No Python binding crate found
- License
- Apache-2.0 OR 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 fast, low-resource Natural Language Processing and Error Correction library. |
8,412 downloads over 30 days | 6 | 679 | 0.6.4 | GPU support unknown | Binds native code: onig_sys (feature regex-onig) | Apache-2.0 OR 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 |
|
whichlang 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 |
|
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 |
|
kitoken Listed
Fast tokenizer for language models, supporting BPE, Unigram and WordPiece tokenization |
2,949 downloads over 30 days | 3 | 62 | 0.11.1 | GPU support unknown | No native code found | BSD-2-Clause |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 4 active dependents and 2 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 679 stars, 46 forks and 6 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
- The project is dormant and not finished. Dormancy rule
What else the check found
- The last activity is on 4 Feb 2022, 1739 days ago. That reaches the 450 days the rules expect, so the project is dormant. Dormancy rule
- The oldest outside issue waits 2042 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule
- The latest release requires the deprecated dependency bincode. RUSTSEC-2025-0141 Rot signals rule
- The project is dormant with 2 rot signals, which reaches the limit of 2. This is dead check 1 of 2, so the entry is not yet archived. Dead rule
Not measured: Latest release fails cargo check.
Check notes
- the repo manifest nlprule/Cargo.toml declares the crate, and no release commit proves the link
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.6.4 base 450: E = 450 daysdormancy: last activity 2022-02-04, 1739 days ago, E = 450: dormantrot: oldest unanswered issue 2042 days (limit 270), no maintainer reply in 365 daysrot: deprecated requirement `bincode (RUSTSEC-2025-0141, https://rustsec.org/advisories/RUSTSEC-2025-0141.html)`dead: dormant with 2 rot signals (limit 2): dead on check 1 of 2, not yet archivedfeatured: not featured: active_users 4 < 11 and new_adopters 2 < 9 and repository route stars 679 (needs 4539), forks 46 (needs 434), contributors 6 (needs 79); dormant and not stablelisted: listed: no archive, new or featured rule applies
Crates2 crates
- nlprule Primary
- nlprule-build
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
- repo manifest, fetched
- GitHub contributors, fetched
Adoption4 active dependents, 2 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 4 | crates.io database dump | Yes | |
| New dependents (365 days) | 2 | crates.io database dump | Yes | |
| Peak active dependents | 4 | 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: 4 years ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2022-02-04 | GitHub repository | Yes | |
| Latest release | 2021-04-24 | crates.io database dump | Yes | |
| First release | 2021-01-17 | crates.io database dump | Yes | |
| Latest version | 0.6.4 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 2042 | 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 | repo manifest | 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 | bincode (RUSTSEC-2025-0141, https://rustsec.org/advisories/RUSTSEC-2025-0141.html) | crates.io database dump | Yes |
Distribution12 releases, 8,412 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 12 | crates.io database dump | Yes | |
| Downloads over 30 days | 8412 | 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 |
Repository679 stars, 46 forks, 6 contributors, 368 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 679 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 46 | 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 | 368 | 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 | Apache-2.0 OR 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 | Binds native code: onig_sys (feature regex-onig) | 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 | 6 | 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.