random_name_generator
This is a rust port of the Ruby port of the Java Random Name Generator library.
It generates it's results based upon which language file is specified. Currently, the following are supported:
- Elven
- Fantasy
- Goblin
- Roman
The following are in progress:
- Curse
- Demonic
Using the library
use ;
It is possible to control the number of syllables for a generated name:
use ;
One can also pass in custom language files:
use rnglib::{RNG};
fn main() {
let rng = RNG::new_from_file("src/languages/Test-tiny.txt").unwrap();
let name = rng.generate_name();
println!("{}: {}", rng.name, name)
}
Running the binary
To get information about the available options, run help.
Using cargo:
$> cargo run -- --help
RandomNameGenerator 0.1.2
Christoph <gaoler@electronicpanopticon.com>
Generates random names in various languages
USAGE:
rng [FLAGS]
FLAGS:
-c, --curse Use the Curse language [UNDER CONSTRUCTION]
-d, --demonic Use the Demonic language [UNDER CONSTRUCTION]
--dump Print out the raw lanuage file
-e, --elven Use the Elven language
-f, --fantasy Use the Fantasy language
-x, --flipmode Use a random language
-g, --goblin Use the Goblin language
-h, --help Prints help information
-r, --roman Use the Roman language
-V, --version Prints version information
or from the binary:
$> rng --help
Passing in one of the language flags will generate a name using that Language's source file.
From cargo:
$> cargo run -- -g
Goblin: zradogul bargodul
From the binary:
$> rng -e
Elven: daedar latherdre
Dependencies
Dev Dependencies
- Criterion for benchmarking
- Proptest - Hypothesis-like property testing for Rust
- Rstest - Fixture-based test framework for Rust
TODO
- Add in Russian support available in the Ruby version.
- Finish Demonic
- Use clap types for number of generated words and syllables.