Crates.io | witty-phrase-generator |
lib.rs | witty-phrase-generator |
version | 0.2.0 |
source | src |
created_at | 2021-06-23 18:31:49.643481 |
updated_at | 2021-07-01 03:22:56.217637 |
description | Generates witty three-word phrases suitable for memorable default names. |
homepage | |
repository | https://github.com/Exr0nProjects/witty-phrase-generator |
max_upload_size | |
id | 414076 |
size | 277,833 |
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.
$ 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!