10 releases (3 stable)
1.1.0 | Dec 3, 2023 |
---|---|
1.0.1 | Nov 16, 2023 |
1.0.0 | May 2, 2022 |
0.2.0 | Mar 20, 2021 |
0.1.2 | Jun 28, 2020 |
#623 in Text processing
24 downloads per month
225KB
855 lines
Owoify-rs
Turning your worst nightmare into a crate package.
This is a Rust port of mohan-cao's owoify-js, which will help you turn any string into nonsensical babyspeak similar to LeafySweet's infamous Chrome extension.
Just like owoify-js, three levels are available for owoifying your texts:
- owo (default): The most vanilla one.
- uwu: The moderate one.
- uvu: Litewawwy unweadabwal.
Please refer to the original owoify-js repository for more information.
Reason for development
While there is already an owoify crate on crates.io, it doesn't provide different levels of owoness, and the owoness is also lighter, which makes the resulting sentences far more readable. For any user who wants to use owoify, the less readable the sentence, the better in my humble opinion.
Install instructions
Just like any crates, simply put this line inside your Cargo.toml
:
[dependencies]
owoify_rs = "~1.0.0"
Alternatively, pull the crate directly from the repository:
[dependencies]
owoify_rs = { git = "https://github.com/deadshot465/owoify_rs", branch = "regex" }
Note that the reason for setting the branch and that the default branch is the regex
branch is that the onig crate seems to have some inconsistencies despite the regexes are the same.
Usage
Owoify-rs is implemented as a trait, and is implemented for both String
and &str
.
use owoify_rs::{Owoifiable, OwoifyLevel};
fn main() {
let owo_str = String::from("This is the string to owo! Kinda cute isn't it?");
let uvu_str = String::from("This is the string to owo! Kinda cute isn't it?");
println!("{}", owo_str.owoify(OwoifyLevel::Owo));
println!("{}", uvu_str.owoify(OwoifyLevel::Uvu));
// Output:
// This is teh stwing two owo! Kinda cute isn't it?
// fwis is teh stwing twowo owowowo (⌒ω⌒) Kinda cute isn't it?
}
Limitations
Since the regex crate doesn't support negative lookahead, and onig
shows inconsistent behaviors despite the regexes being the same as when using regex
, and fancy-regex doesn't support captures_iter()
method at moment, currently the negative lookahead parts of these three regexes are omitted.
See the source code of src/utility/mappings.rs
to see commented out regexes.
Disclaimer
This crate was written to help myself get used to Rust's syntaxes and writing Rust programs. Performance is NOT guaranteed.
See also
- owoify-js - The original owoify-js repository.
- Owoify.Net - The C# port of Owoify written by me.
- Owoify++ - The C++ header-only port of Owoify written by me.
- owoify_rs - The Rust port of Owoify written by me.
- owoify-py - The Python port of Owoify written by me.
- owoify_dart - The Dart port of Owoify written by me.
- owoify_rb - The Ruby port of Owoify written by me.
- owoify-go - The Go port of Owoify written by me.
- owoifySwift - The Swift port of Owoify written by me.
- owoifyKt - The Kotlin port of Owoify written by me.
- owoify_ex - The Elixir port of Owoify written by me.
- owoify_cr - The Crystal port of Owoify written by me.
- owoifynim - The Nim port of Owoify written by me.
- owoify-clj - The Clojure port of Owoify written by me.
- purescript-owoify - The PureScript port of Owoify written by me.
- owoify-hs - The Haskell port of Owoify written by me.
- owoify_erl - The Erlang port of Owoify written by me.
Dependencies
~2.5–3.5MB
~60K SLoC