udpipe-rs

Library Listed

Rust bindings for UDPipe - a trainable pipeline for tokenization, tagging, lemmatization and dependency parsing of CoNLL-U files

Checked · Sources

Downloads
3,069
Dependents
2
Stars
5
Forks
1
Contributors
4
Commits
27
Latest release
0.2.0 ·

About

From the project README ·

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 &Model across 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.

FieldTypeDescription
wordsVec<Word>Words in the sentence (1-based IDs, no virtual root)
multiword_tokensVec<MultiwordToken>Contractions / multiword tokens (e.g. "don't")
commentsVec<String>CoNLL-U comment lines
[Word]

Each parsed word contains:

FieldTypeDescription
formStringThe surface form (actual text)
lemmaStringThe lemma (dictionary form)
upostagStringUniversal POS tag (NOUN, VERB, ADJ, etc.)
xpostagStringLanguage-specific POS tag
featsStringMorphological features (e.g. "Mood=Imp|VerbForm=Fin")
deprelStringDependency relation (root, nsubj, obj, etc.)
depsStringEnhanced dependencies
miscStringMiscellaneous annotations (e.g. "SpaceAfter=No")
idi321-based index of this word within its sentence
headi32Index of head word (0 = root of sentence)
childrenVec<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.

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.

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

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 days
  • dormancy: last activity 2026-09-21, 49 days ago, E = 365: active
  • featured: 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
Adoption2 active dependents, 2 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents2crates.io database dumpYes
New dependents (365 days)2crates.io database dumpYes
Peak active dependents2crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 49 days ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-09-21GitHub repositoryYes
Latest release2026-01-25crates.io database dumpYes
First release2025-12-25crates.io database dumpYes
Latest version0.2.0crates.io database dumpYes
Days the oldest outside issue waits for a reply0GitHub 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
Distribution9 releases, 3,069 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases9crates.io database dumpYes
Downloads over 30 days3069crates.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
Repository5 stars, 1 forks, 4 contributors, 27 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars5GitHub repositoryYes — one part of the repository route
GitHub forks1GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account4GitHub contributorsYes — one part of the repository route
Commits on the default branch27GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0 OR MITcrates.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 dependenciesBuild uses a native toolchain: cccrates.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 directly2crates.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.