Crates.io | poetrie |
lib.rs | poetrie |
version | 0.9.5 |
created_at | 2025-07-06 18:09:25.449142+00 |
updated_at | 2025-07-11 21:14:43.935394+00 |
description | Poetic trie crafted with intetion to ease searching of rhymes for poems. |
homepage | |
repository | https://github.com/deep-outcome/tries/tree/main/trie |
max_upload_size | |
id | 1740341 |
size | 65,802 |
Poetrie means poetic trie. Poetrie is designated for searching common suffixes of words.
let mut poetrie = Poetrie::nw();
let words = ["analytics", "metrics", "ethics", "Acoustics"]
.map(|x| Entry::new_from_str(x).unwrap());
for w in words {
poetrie.it(&w);
}
let probe = Entry::new_from_str("lyrics").unwrap();
let matchee = poetrie.sx(&probe);
assert_eq!(Ok(String::from("metrics")), matchee);
let probe = Entry::new_from_str("solemn").unwrap();
assert_eq!(Err(FindErr::NoJointSuffix), poetrie.sx(&probe));
Thinking about what could be good rhyming with word of choice, simple try search for that suffix directly. Let say, having "lyrics" as word without match, thinking it should rhyme with something ending with "ynx".
let mut poetrie = Poetrie::nw();
let words = ["lynx", "index"].map(|x| Entry::new_from_str(x).unwrap());
for w in words {
poetrie.it(&w);
}
let probe = Entry::new_from_str("ynx").unwrap();
let matchee = poetrie.sx(&probe);
assert_eq!(Ok(String::from("lynx")), matchee);
Now, one goes: "As the paws in a snow, laid down by lightening lynx, my word goes there and forth, composing the aerial lyrics.".