3 unstable releases

new 0.2.0 May 7, 2025
0.1.1 Sep 2, 2021
0.1.0 Sep 2, 2021

#475 in Algorithms

Download history 5/week @ 2025-01-17 14/week @ 2025-01-24 16/week @ 2025-01-31 49/week @ 2025-02-07 35/week @ 2025-02-14 11/week @ 2025-02-21 7/week @ 2025-02-28 6/week @ 2025-03-07 12/week @ 2025-03-14 2/week @ 2025-03-21 2/week @ 2025-03-28 2/week @ 2025-04-04 14/week @ 2025-04-11 6/week @ 2025-04-25 112/week @ 2025-05-02

133 downloads per month
Used in 2 crates

MIT license

12KB
225 lines

Generate random pronounceable words.

Quickstart

Gabble provides type [Gab] and GabLength that represents a random pseudo-word. These types implement Distribution trait which means they can be generated in an idomatic way by using method from rand::Rng such as gen().

Example

use rand::{rng, Rng};
let mut rng = rng();

// `Gab` gives gibberish of some moderate length
use gabble::Gab;
let word: Gab = rng.random();
println!("{} might be answer to life", word);

// `GabLength` gives gibberish of minimum N length
use gabble::GabLength;
let word: GabLength<14> = rng.random();
println!("{} is a long word", word);

[Gab] and GabLength can be treated as string as they simply deref to String.

Custom Generation

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

Example

use gabble::Gabble;
use gabble::Syllable::{Alphabet, Consonant};
use rand::rng;
let mut rng = rng();

let gabble = Gabble::new()
.with_length(10)
.starts_with(Alphabet)
.ends_with(Consonant);
println!("customized answer to life is {}", gabble.generate(&mut rng));

These pseudo-words are generated by combining vowel and consonant syllables together. This crate is mostly inspired from python package called gibberish


gabble

Library crate for generating pseudo-word.

Example

use rand::{thread_rng, Rng};
let mut rng = thread_rng();

// `Gab` gives gibberish of some moderate length
use gabble::Gab;
let word: Gab = rng.gen();
println!("{} might be answer to life", word);

// `GabLength` gives gibberish of minimum N length
use gabble::GabLength;
let word: GabLength<14> = rng.gen();
println!("{} is a long word", word);

Top words

  • ilaincy
  • gruimsab
  • graoness
  • duieyaior

Words are generated by combining vowel-consonant syllables. If you want words that closely resembles regular english then look for some library that uses markov chain.

Dependencies

~405KB