use engish::language::{Adjective, Dictionary, Noun, Verb, DictionarySampling};
use rand::rng;
fn main() {
let mut dict = Dictionary::new();
println!("Created a new, empty dictionary.");
dict.add_word(Noun::new_proper("Gandalf"));
dict.add_word(Noun::new_common("wizard"));
dict.add_word(Noun::new_common("staff"));
dict.add_word(Noun::new_proper("Frodo"));
dict.add_word(Verb::new_regular("walk"));
dict.add_word(Verb::new_regular("cast"));
dict.add_word(Adjective::new_regular("grey"));
dict.add_word(Adjective::new_regular("brave"));
dict.add_word(Adjective::new_regular("small"));
println!(
"Dictionary populated with {} nouns, {} verbs, and {} adjectives.\n",
dict.get_all::<Noun>().len(),
dict.get_all::<Verb>().len(),
dict.get_all::<Adjective>().len()
);
let mut rng = rng();
println!("--- Simple Random Sampling ---");
if let Some(noun) = dict.choose::<Noun>(&mut rng) {
println!("Randomly selected noun: {}", noun);
}
if let Some(verb) = dict.choose::<Verb>(&mut rng) {
println!("Randomly selected verb: {}", verb);
}
println!();
println!("--- Filtered Random Sampling ---");
let random_proper_noun = dict.choose_filtered::<Noun, _>(|n| n.is_proper(), &mut rng);
println!("Randomly selected proper noun: {}", random_proper_noun.unwrap());
}