gabble/lib.rs
1/*!
2Generate random pronounceable words.
3
4## Quickstart
5Gabble provides type [`Gab`] and [`GabLength`] that represents a random pseudo-word.
6These types implement [`Distribution`](rand::distributions) trait which means they can be generated in an idomatic way by using method from [`rand::Rng`] such as [`gen()`](rand::Rng::gen()).
7### Example
8``` rust
9use rand::{rng, Rng};
10let mut rng = rng();
11
12// `Gab` gives gibberish of some moderate length
13use gabble::Gab;
14let word: Gab = rng.random();
15println!("{} might be answer to life", word);
16
17// `GabLength` gives gibberish of minimum N length
18use gabble::GabLength;
19let word: GabLength<14> = rng.random();
20println!("{} is a long word", word);
21```
22[`Gab`] and [`GabLength`] can be treated as string as they simply deref to [`String`].
23
24## Custom Generation
25Additionally there is [`Gabble`] type which can be used to generate pseudo-words with a bit more customization. You can tweak length, starting and ending syllable for now.
26### Example
27``` rust
28use gabble::Gabble;
29use gabble::Syllable::{Alphabet, Consonant};
30use rand::rng;
31let mut rng = rng();
32
33let gabble = Gabble::new()
34 .with_length(10)
35 .starts_with(Alphabet)
36 .ends_with(Consonant);
37println!("customized answer to life is {}", gabble.generate(&mut rng));
38```
39
40These pseudo-words are generated by combining vowel and consonant syllables together. This crate is mostly inspired from python package called [gibberish](https://github.com/greghaskins/gibberish)
41
42*/
43
44mod default;
45mod gabble;
46mod generator;
47mod length;
48mod syllables;
49
50pub use crate::default::Gab;
51pub use crate::gabble::Gabble;
52pub use crate::length::GabLength;pub use crate::syllables::Syllable;
53use crate::syllables::{FINALS, INITIALS, VOWELS};