#phrase #generator #random #name

bin+lib witty-phrase-generator

Generates witty three-word phrases suitable for memorable default names

3 releases (breaking)

0.2.0 Jul 1, 2021
0.1.0 Jun 24, 2021
0.0.1 Jun 23, 2021

#2770 in Command line utilities

Download history 69/week @ 2024-01-01 146/week @ 2024-01-08 127/week @ 2024-01-15 53/week @ 2024-01-22 56/week @ 2024-01-29 281/week @ 2024-02-05 121/week @ 2024-02-12 186/week @ 2024-02-19 195/week @ 2024-02-26 38/week @ 2024-03-04 113/week @ 2024-03-11 79/week @ 2024-03-18 137/week @ 2024-03-25 132/week @ 2024-04-01 101/week @ 2024-04-08 120/week @ 2024-04-15

491 downloads per month
Used in 3 crates

Custom license

87KB
166 lines

witty-phrase-generator

Generates three-word phrases of the form intensifier-adjective-noun, just like GitHub default repo names.

Has minimal dependencies (just rand and getopts) and minimal bloat. Uses backtracking and binary search when constraints are tight to avoid repeated computation and maximize speed.

Usage

$ witty-phrase-generator        # -> staggeringly-wise-alchohol
$ witty-phrase-generator -2     # -> fantastic brush
$ witty-phrase-generator -n 4   # (outputs 4 lines of 3-word phrases)
use witty_phrase_generator::WPGen;

fn main() {
    let wp_gen = WPGen::new();  // contains its own thread_rng
    wp_gen.generic(3,           // words per phrase
                   30,          // phrases
                   Some(25),    // minimum length
                   Some(25),    // maximum length
                   Some('a'),   // alliterate with 'a'
                   ).expect("Could not satisfy constraints!");
}

Also supports alliteration, max length, and other features. Use witty-phrase-generator --help or check the docstrings to learn more!

Improvements

  • always looking for more witty words to add to the wordlist.
  • can have duplicates (common if constraints are tight)
  • allow generating with a given length but variable number of words

Dependencies

~450KB