Crates.io | syllarust |
lib.rs | syllarust |
version | 0.1.1 |
source | src |
created_at | 2024-03-12 21:16:55.540048 |
updated_at | 2024-05-07 21:35:34.622689 |
description | A simple crate for quickly counting syllables |
homepage | |
repository | https://github.com/cyalen/syllable-rs |
max_upload_size | |
id | 1171011 |
size | 29,430 |
A simple syllable counter implemented natively in Rust. This is based on the work of the python-syllables team, which implents the same functionality in Python.
My goal was to bring the same ease/simplicity to Rust - and use Rust's fearless concurrency model to help improve the speed/quality at which syllable counts can be generated. This means if you're trying to generate syllable counts for large NLP/LLM applications where speed matters, this may be the crate you're looking for!
use syllarust::estimate_syllables;
use rayon::prelude::*;
fn main() {
let test_strs: Vec<&str> = vec![
"Apple",
"Tart",
"plate",
"Pontificate",
"Hello"
];
let start = Instant::now();
let results: Vec<usize> = test_strs.par_iter()
.map(|s| estimate_syllables(s))
.collect();
let stop = Instant::now();
println!("{:?}", stop - start);
println!("{:?}", results);
}
This is currently a work-in-progress repo. If you have any feature requests/spot a bug, leave me an issue and I'll try and tackle it when I can. I'm also open to sensible PRs.
If you're a more experienced Rust dev and you spy any inefficiencies, I'd be grateful for your feedback. I'm a relatively new Rustacean :crab: who works full-time as a Python-native ML Engineer, and therefore I might do dumb things sometimes.