udpipe-rs
Library Listed
Rust bindings for UDPipe - a trainable pipeline for tokenization, tagging, lemmatization and dependency parsing of CoNLL-U files
- Downloads
- 3,069
- Dependents
- 2
- Stars
- 5
- Forks
- 1
- Contributors
- 4
- Commits
- 27
- Latest release
- 0.2.0 ·
About
Rust bindings for UDPipe — a trainable pipeline for tokenization, tagging, lemmatization, and dependency parsing using Universal Dependencies.
Rust’s NLP ecosystem still lacks an integrated, production-ready pipeline comparable to spaCy. Most crates are either single-purpose (e.g. sentiment, language detection), transformer-inference only (e.g. rust-bert), or rule-based (e.g. nlprule). This library aims to fill that gap: one pipeline, many languages, trainable models, and a simple API.
Features
- Full parsing pipeline: Tokenization, POS tagging, lemmatization, and dependency parsing
- Universal Dependencies: Output follows the UD annotation scheme
- Model download utility: Easy download of pre-trained models for 65+ languages (optional)
- Thread-friendly: Models are
Send(can be moved between threads)
Installation
Without the download feature (default)
Use this if you already have .udpipe model files and only need parsing. No extra dependencies.
Add to your Cargo.toml:
[dependencies]
udpipe-rs = "0.1"
Or via command line:
cargo add udpipe-rs
Read the full README
With the download feature
Use this if you want to fetch pre-trained models by language tag (e.g. download_model("english-ewt", ".")) or from a custom URL. This enables the download feature and adds the ureq dependency.
Add to your Cargo.toml:
[dependencies]
udpipe-rs = { version = "0.1", features = ["download"] }
Or via command line:
cargo add udpipe-rs --features download
Usage
Load a model and parse text
Create a parser with [Model::parser] for a given text; it returns an iterator over sentences. Each sentence contains words and optional multiword tokens and comments. Use any .udpipe model file at any path.
use udpipe_rs::Model;
fn main() -> Result<(), udpipe_rs::UdpipeError> {
// Load a model from a path (any language, any location)
let model = Model::load("path/to/model.udpipe")?;
// Create a parser for the text
let parser = model.parser("The quick brown fox jumps over the lazy dog.")?;
// Iterate over sentences (each item is Result<Sentence, UdpipeError>)
for sentence in parser {
let sentence = sentence?;
for word in &sentence.words {
println!("{:<4} {:<10} {:<6} {:<10} {:>2} <- {}",
word.id,
word.form,
word.upostag,
word.lemma,
word.head,
word.deprel
);
}
}
Ok(())
}
Output:
1 The DET the 2 <- det
2 quick ADJ quick 5 <- amod
3 brown ADJ brown 5 <- amod
4 fox NOUN fox 5 <- nsubj
5 jumps VERB jump 0 <- root
6 over ADP over 9 <- case
7 the DET the 9 <- det
8 lazy ADJ lazy 9 <- amod
9 dog NOUN dog 5 <- obl
10 . PUNCT . 5 <- punct
To fetch a model by language tag instead of using a local file, enable the download feature and use [download_model]:
use udpipe_rs::{download_model, Model};
// Requires: udpipe-rs with feature "download"
let model_path = download_model("english-ewt", ".")?;
let model = Model::load(&model_path)?;
Available languages
Pre-trained models are available for 65+ languages. Use [udpipe_rs::AVAILABLE_MODELS] to see the full list:
// Some examples:
// "english-ewt", "english-gum", "english-lines", "english-partut"
// "german-gsd", "german-hdt"
// "french-gsd", "french-sequoia", "french-spoken"
// "spanish-ancora", "spanish-gsd"
// "dutch-alpino", "dutch-lassysmall"
// "chinese-gsd", "japanese-gsd", "korean-gsd"
// ... and many more
for lang in udpipe_rs::AVAILABLE_MODELS {
println!("{}", lang);
}
Working with morphological features
[Word::feats] is a string of pipe-separated key-value pairs (e.g. "VerbForm=Fin|Mood=Ind|Tense=Pres"). Parse it as needed:
use udpipe_rs::Model;
fn main() -> Result<(), udpipe_rs::UdpipeError> {
let model = Model::load("path/to/your-model.udpipe")?;
let parser = model.parser("Run quickly!")?;
for sentence in parser {
let sentence = sentence?;
for word in &sentence.words {
// Check for imperative: look for Mood=Imp in feats
if word.upostag == "VERB" || word.upostag == "AUX" {
if word.feats.contains("Mood=Imp") {
println!("Found imperative: {}", word.form);
}
}
// Parse feats for specific keys (e.g. Tense=Pres)
for pair in word.feats.split('|') {
if let Some((k, v)) = pair.split_once('=') {
if k.trim() == "Tense" {
println!("{} has tense: {}", word.form, v.trim());
}
}
}
}
}
Ok(())
}
Working with sentence structure
The parser yields one [Sentence] per call to [Iterator::next]. Each sentence has words, multiword_tokens, and comments:
use udpipe_rs::Model;
fn main() -> Result<(), udpipe_rs::UdpipeError> {
let model = Model::load("english-ewt-ud-2.5-191206.udpipe")?;
let parser = model.parser("Hello world. Goodbye world.")?;
for (idx, sentence) in parser.enumerate() {
let sentence = sentence?;
println!("--- Sentence {} ---", idx + 1);
for word in &sentence.words {
println!(" {}: {} ({})", word.id, word.form, word.upostag);
}
}
Ok(())
}
Download from custom URL
With the download feature, [download_model_from_url] writes the model to a file at the given path:
use udpipe_rs::download_model_from_url;
download_model_from_url(
"https://example.com/custom-model.udpipe",
"custom-model.udpipe",
)?;
Thread Safety
Model is [Send] but not [Sync]. This means:
- You can move a model to another thread (ownership transfer)
- You cannot share
&Modelacross threads simultaneously
For concurrent access, either:
Option 1: Wrap in Mutex (shared model, serialized access)
use std::sync::{Arc, Mutex};
use udpipe_rs::Model;
let model = Arc::new(Mutex::new(Model::load("model.udpipe")?));
let model_clone = Arc::clone(&model);
std::thread::spawn(move || {
let guard = model_clone.lock().unwrap();
let parser = guard.parser("Hello world").unwrap();
for sentence in parser {
let _ = sentence.unwrap();
}
});
Option 2: Separate models per thread (parallel access, higher memory)
use udpipe_rs::Model;
std::thread::spawn(|| {
let model = Model::load("model.udpipe").unwrap();
let parser = model.parser("Hello world").unwrap();
for sentence in parser {
let _ = sentence.unwrap();
}
});
API Reference
[Sentence]
A parsed sentence from the pipeline.
| Field | Type | Description |
|---|---|---|
words | Vec<Word> | Words in the sentence (1-based IDs, no virtual root) |
multiword_tokens | Vec<MultiwordToken> | Contractions / multiword tokens (e.g. "don't") |
comments | Vec<String> | CoNLL-U comment lines |
[Word]
Each parsed word contains:
| Field | Type | Description |
|---|---|---|
form | String | The surface form (actual text) |
lemma | String | The lemma (dictionary form) |
upostag | String | Universal POS tag (NOUN, VERB, ADJ, etc.) |
xpostag | String | Language-specific POS tag |
feats | String | Morphological features (e.g. "Mood=Imp|VerbForm=Fin") |
deprel | String | Dependency relation (root, nsubj, obj, etc.) |
deps | String | Enhanced dependencies |
misc | String | Miscellaneous annotations (e.g. "SpaceAfter=No") |
id | i32 | 1-based index of this word within its sentence |
head | i32 | Index of head word (0 = root of sentence) |
children | Vec<i32> | Indices of child words in the dependency tree |
Features in feats are pipe-separated Key=Value pairs; parse them as needed (e.g. check upostag for VERB/AUX, or search feats for "Mood=Imp").
Examples
Both examples work with any language model at any path.
# Download the English model to a models directory (requires the 'download' feature)
cargo run --example download_model -- english-ewt ./models
# Parse text with that model
cargo run --example parse_text -- ./models/english-ewt-ud-2.5-191206.udpipe "The quick brown fox jumps over the lazy dog."
Models
Pre-trained models for 100+ treebanks are available from the LINDAT/CLARIAH-CZ repository. With the download feature, the [download_model] function fetches from this repository by language tag. Without it, use any .udpipe file at any path with [Model::load].
Requirements
For users: A C++ compiler with C++11 support. The build script compiles UDPipe as a static library automatically.
For contributors: Just Docker. See CONTRIBUTING.md for details.
License
This crate is dual-licensed under MIT OR Apache-2.0.
UDPipe itself is licensed under the Mozilla Public License 2.0.
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- Build tool
- Build uses a native toolchain: cc
- 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 |
|---|---|---|---|---|---|---|---|
|
Rust bindings for UDPipe - a trainable pipeline for tokenization, tagging, lemmatization and dependency parsing of CoNLL-U files |
3,069 downloads over 30 days | 2 | 5 | 0.2.0 | GPU support unknown | Build uses a native toolchain: cc | Apache-2.0 OR 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 |
|
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 2 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 5 stars, 1 fork and 4 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
What else the check found
- The last activity is on 21 Sep 2026, 49 days ago. The rules expect an update within 365 days. Dormancy 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.2.0 base 80, raised to the 365-day floor: E = 365 daysdormancy: last activity 2026-09-21, 49 days ago, E = 365: activefeatured: not featured: active_users 2 < 11 and new_adopters 2 < 9 and repository route stars 5 (needs 4539), forks 1 (needs 434), contributors 4 (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
Adoption2 active dependents, 2 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 2 | crates.io database dump | Yes | |
| New dependents (365 days) | 2 | crates.io database dump | Yes | |
| Peak active dependents | 2 | 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: 49 days ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-09-21 | GitHub repository | Yes | |
| Latest release | 2026-01-25 | crates.io database dump | Yes | |
| First release | 2025-12-25 | crates.io database dump | Yes | |
| Latest version | 0.2.0 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 0 | 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 |
Distribution9 releases, 3,069 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 9 | crates.io database dump | Yes | |
| Downloads over 30 days | 3069 | 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 |
Repository5 stars, 1 forks, 4 contributors, 27 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 5 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 1 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 4 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 27 | 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 | Build uses a native toolchain: cc | 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 | 2 | 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.