2 releases
0.1.1 | Dec 29, 2024 |
---|---|
0.1.0 | Dec 29, 2024 |
#1191 in Command line utilities
228 downloads per month
17KB
52 lines
Gen-Alpha Dictionary
Easily learn gen-alpha (or, as found in the wild, iPad kids) phrases with a Rust Command Line Interface (CLI) and a hand-compiled list of 250 common words and prashes of your favorite 10-year-old.
Install
To use as a dependency
[dependencies]
gen_alpha_dictionary = "0.1.0"
Usage
To use in a project
Import:
use std::process;
use serde_json::Value;
use gen_alpha_dictionary::dictionary;
Parse JSON from web:
let dict: Value = dictionary::parse_web_json("https://raw.githubusercontent.com/crnicholson/gen_alpha_dictionary/refs/heads/master/dict.json").unwrap_or_else(|err| {
if err.to_string().contains("status code 500") {
println!("Problem fetching JSON data.")
} else {
println!("Problem parsing dictionary: {err}");
}
process::exit(1);
});
Or, parse JSON locally:
let dict: Value = dictionary::parse_local_json("dict.json").unwrap_or_else(|err| {
println!("Problem parsing dictionary: {err}");
process::exit(1);
});
And finally, get the definition of the word:
let result = dictionary::define_word(&dict, &word).unwrap_or_else(|err | {
println!("{err}");
process::exit(1);
});
To use as a CLI
Install:
git clone https://github.com/crnicholson/gen_alpha_dictionary.git
cd gen_alpha_dictionary
Run:
cargo run -- "skibid"
This will find the definition of skibidi. Double qoutes are unnecessary for single word prashes.
License
Licensed under MIT. Copyright 2024 Charles Nicholson.
Dependencies
~3–4.5MB
~80K SLoC