Crates.io | leetspeak |
lib.rs | leetspeak |
version | 0.2.0 |
source | src |
created_at | 2022-10-24 01:14:41.992745 |
updated_at | 2022-12-08 18:06:24.524181 |
description | random, non-random, and custom leetspeak translation functions |
homepage | |
repository | https://github.com/EthanC2/leetspeak |
max_upload_size | |
id | 695473 |
size | 65,806 |
leetspeak is a english-to-leetspeak translation library with support for random, non-random, and custom leetspeak translation. Translations are based on wikipedia/leet#orthography. Using this library is as simple as:
use leetspeak::Level;
let text = "sphinx of black quartz, judge my vow";
// Random leetspeak translation
let random_translation = leetspeak::translate(text);
// Non-random leetspeak translation, levels 1-3
let nonrandom_translation = leetspeak::translate_with_level(text, &Level::One);
assert_eq!(nonrandom_translation, r#"5ph1nx 0f 814ck qu427z, jud93 my v0w"#);
//Custom leetspeak translation (case-insensitive). Characters not in the hashmap are not changed.
let mapping = std::collections::HashMap::from([
('a', String::from("4")),
('c', String::from("<")),
('e', String::from("€")),
('m', String::from(r#"/\/\"#)),
('p', String::from("|*")),
('s', String::from("ehs")),
('w', String::from("vv")),
('z', String::from("7_")),
]);
let custom_translation = leetspeak::translate_custom(text, mapping, &false);
assert_eq!(custom_translation, r#"ehs|*hinx of bl4<k qu4rt7_, judg€ /\/\y vovv"#);
This is an open-source project and contributors are welcome! The repository is at github.com: leetspeak and development plans/progress are documented at github.com: leetspeak/projects. If this library is missing a feature you would like, feel free to start a discussion or develop a feature and create a pull request.