| Crates.io | rs-conllu |
| lib.rs | rs-conllu |
| version | 0.4.1 |
| created_at | 2023-04-22 07:52:19.808149+00 |
| updated_at | 2025-05-27 20:01:29.977133+00 |
| description | A parser for the CoNLL-U format of the Universal Dependencies project. |
| homepage | |
| repository | https://github.com/dahelb/rs-conllu |
| max_upload_size | |
| id | 845862 |
| size | 45,947 |
This project aims to provide a parser for the CoNLL-U format of the Universal Dependencies project: https://universaldependencies.org/format.html.
Parse a file in CoNLL-U format and iterate over the containing sentences.
use rs_conllu::parse_file;
use std::fs::File;
let file = File::open("tests/example.conllu")?;
let parsed = parse_file(file)?;
// Iterate over the contained sentences.
for sentence in parsed {
// We can also iterate over the tokens in the sentence.
for token in sentence {
// Process token, e.g. access individual fields.
println!("{}", token.form)
}
}
Parsing happens in a "flat" manner, relations between tokens are not respected.