poetrie 0.9.0

Poetic trie crafted with intetion to ease searching of rhymes for poems.
Documentation
poetrie-0.9.0 has been yanked.

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 choise, 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, layed down by lightening lynx, my word goes there and forth, composing the aerial lyrics.".