UwUify your strings with uwurs! This Rust library transforms text into the playful "UwU" style by applying various character transformations, adding stutters, leetifying text, and more.
This documentation corresponds to uwurs version 0.3.1
[dependencies]
uwurs = "0.3.1"
rand = "0.8.5"
- Install by adding to
Cargo.toml
or viacargo add uwurs
- Import and create an instance of UwUifier.
- Transform your text using provided methods.
- Customize settings and mappings as desired.
- Enjoy UwUifying your text!
To start using uwurs, create a new instance of UwUifier:
use uwurs::UwUifier;
fn main() {
let uwuifier = UwUifier::new();
let input = "Hello, world!";
let uwuified = uwuifier.uwuify(input);
println!("{}", uwuified);
}
Transform a string into UwU style:
let input = "This is a test.";
let uwuified = uwuifier.uwuify(input);
println!("{}", uwuified);
Convert text to leet speak:
let input = "Leetify this text.";
let leet = uwuifier.leetify(input);
println!("{}", leet);
Reverse the characters in a string:
let input = "Reverse this.";
let reversed = uwuifier.reverse_text(input);
println!("{}", reversed);
Adjust the probability of adding stutters to words:
uwuifier.set_stutter_probability(0.2); // 20% chance
Adjust the probability of adding emojis:
uwuifier.set_emoji_probability(0.3); // 30% chance
Add custom emoticons to the UwUifier:
uwuifier.add_emoticon("(* ^ Ο ^)");
Add custom interjections:
uwuifier.add_interjection("nya");
Define custom word mappings:
uwuifier.add_custom_mapping("hello", "hewwo");
Associate words with emojis:
uwuifier.add_emoji_mapping("happy", "π");
pub struct UwUifier {
pub emoticons: Vec<&'static str>,
pub interjections: Vec<&'static str>,
pub stutter_probability: f64,
pub emoji_probability: f64,
pub custom_map: HashMap<String, String>,
pub emoji_map: HashMap<String, String>,
}
Create a new UwUifier instance with default settings
new() -> Self
Transform the input string into UwU style
uwuify(&self, input: &str) -> String
Set the probability for stuttering
set_stutter_probability(&mut self, probability: f64)
Set the probability for adding emojis
set_emoji_probability(&mut self, probability: f64)
Add a new emoticon to the list
add_emoticon(&mut self, emoticon: &'static str)
Add a new interjection
add_interjection(&mut self, interjection: &'static str)
Add a custom word mapping
add_custom_mapping(&mut self, from: &str, to: &str)
Associate a word with an emoji
add_emoji_mapping(&mut self, word: &str, emoji: &str)
Convert the input string to leet speak
leetify(&self, input: &str) -> String
Reverse the input string
reverse_text(&self, input: &str) -> String
Transform specific characters to UwU style
apply_character_transformations
Add a stutter to a word based on probability
apply_stutter
Convert characters to their leet equivalents
leetify
Reverse the input string
reverse_text
use uwurs::UwUifier;
fn main() {
let uwuifier = UwUifier::new();
let input = "I love programming!";
let uwuified = uwuifier.uwuify(input);
println!("{}", uwuified);
}
use uwurs::UwUifier;
fn main() {
let mut uwuifier = UwUifier::new();
uwuifier.add_custom_mapping("friend", "fwiend");
uwuifier.add_emoji_mapping("happy", "π");
let input = "Hello, my friend! I am happy.";
let uwuified = uwuifier.uwuify(input);
println!("{}", uwuified);
}
use uwurs::UwUifier;
fn main() {
let uwuifier = UwUifier::new();
let leet = uwuifier.leetify("Leetify this text.");
println!("{}", leet);
let reversed = uwuifier.reverse_text("Reverse this.");
println!("{}", reversed);
}
Contributions are welcome! Please submit a pull request or open an issue on the GitHub Repository.
If you'd like to contribute to uwurs, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes with clear messages.
- Submit a pull request detailing your changes.
- Please ensure that your code follows the project's coding standards and includes appropriate tests.