owoify_rs

Crates.ioowoify_rs
lib.rsowoify_rs
version1.1.0
sourcesrc
created_at2020-06-21 07:03:38.361922
updated_at2023-12-03 17:24:54.302629
descriptionThis Rust port of mohan-cao's owoify-js is released under MIT license, which is also the same license of owoify-js. This simple library will turn any string into nonsensical babyspeak similar to what LeafySweet's infamous Chrome extension did.
homepagehttps://github.com/deadshot465/owoify_rs
repositoryhttps://github.com/deadshot465/owoify_rs
max_upload_size
id256235
size224,240
Chehui Chou (deadshot465)

documentation

README

Owoify-rs

Turning your worst nightmare into a crate package.

Rust

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:

  1. owo (default): The most vanilla one.
  2. uwu: The moderate one.
  3. 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.
Commit count: 32

cargo fmt