poetrie 0.9.4

Poetic trie crafted with intetion to ease searching of rhymes for poems.
Documentation
  • Coverage
  • 100%
    17 out of 17 items documented1 out of 12 items with examples
  • Size
  • Source code size: 65.94 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.97 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • deep-outcome

POETRIE

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

Basic Usage

classic use case
let mut poetrie = Poetrie::new();
let words = ["analytics", "metrics", "ethics", "Acoustics"]
    .map(|x| Entry::new_from_str(x).unwrap());
for w in words {
    poetrie.ins(&w);
}

let probe = Entry::new_from_str("lyrics").unwrap();
let matchee = poetrie.suf(&probe);
assert_eq!(Ok(String::from("metrics")), matchee);

let probe = Entry::new_from_str("solemn").unwrap();
assert_eq!(Err(FindErr::NoJointSuffix), poetrie.suf(&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::new();
let words = ["lynx", "index"].map(|x| Entry::new_from_str(x).unwrap());
for w in words {
    poetrie.ins(&w);
}

let probe = Entry::new_from_str("ynx").unwrap();
let matchee = poetrie.suf(&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.".