poetrie

Crates.iopoetrie
lib.rspoetrie
version0.9.5
created_at2025-07-06 18:09:25.449142+00
updated_at2025-07-11 21:14:43.935394+00
descriptionPoetic trie crafted with intetion to ease searching of rhymes for poems.
homepage
repositoryhttps://github.com/deep-outcome/tries/tree/main/trie
max_upload_size
id1740341
size65,802
mr-deepest-outcome (deep-outcome)

documentation

https://docs.rs/poetrie/latest/poetrie/index.html

README

POETRIE

Poetrie means poetic trie. Poetrie is designated for searching common suffixes of words.

Basic Usage

classic use case
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));
handy use case

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."
.

Commit count: 181

cargo fmt