Skip to content

Instantly share code, notes, and snippets.

@uwoneko
Last active April 18, 2024 00:53
Show Gist options
  • Save uwoneko/b5d46b8a56f5642ccc302137b86fe850 to your computer and use it in GitHub Desktop.
Save uwoneko/b5d46b8a56f5642ccc302137b86fe850 to your computer and use it in GitHub Desktop.

Yura uwuifier specification v1.1

Abstract

Yura uwuifier specification describes an algorithm used to convert the text to its "uwuified" form, considering edge cases and keeping the text readable.

This specification follows RFC 2119.

Definitions

EMOJIS is a list of UTF-8 encoded strings. It MUST contain these strings: <3, :3, UwU, OwO, ^^, >w<, >~<, >.<, >w<, ^w^, (◕ᴥ◕), ʕ•ᴥ•ʔ, ʕ→ᴥ←ʔ, (*^ω^), (◕‿◕✿), (*^.^*), (つ✧ω✧)つ, (/ =ω=)/. EMOJIS must not match any of the replacement rules. Implementations MAY amend the list.

PHRASES is a list of strings. It MUST contain these strings: *snuzzwes*, *nuzzwes youw chest*, *wicks uw neck*, *paws*, *puwws*, *meows*, *snugs cwosew*, *pounces on u*. The phrases must not match any of the replacement rules.Implementations MAY amend the list.

ENDOFSTRING is the end of the input string.

Specification

The uwuifier SHOULD produce the same output on the same input.

Uwuification is split into four parts:

  1. Replace all "r" and "l" with "w"
  2. Apply simple replacements
  3. Apply complex replacements
  4. Apply punctuation replacements

Each part MUST be executed in order. All uwuification rules MUST be aplied. Implementations MAY amend the list of rules.

Each replacement in each of the parts MAY be applied in order. Replacements MUST NOT have any "r" or "l" in either the input or the output.

Simple replacements

Each simple replacement is defined in this format:

"x" -> "y"

which means

Replace all occurences of "x" with "y".

Below are the simple replacements.

  1. "wove" -> "wuv"
  2. "nice" -> "nyaice"
  3. "what" -> "wut"
  4. "you" -> "u"
  5. "the" -> "da"
  6. "hewwo" -> "hewo"
  7. "cat" -> "neko"
  8. "kitty" -> "neko"
  9. "cute" -> "kawaii"
  10. "hi" -> "hii"

Complex replacements

Each complex replacement is defined in this format:

(LOOKBACKS) "MATCH" (LOOKFORWARDS)

LOOKBACKS is a list of strings that should be before the match for it to be satisfied.

LOOKFORWARDS is the same but the strings should be after the match.

If a lookaround is preceeded with "!", it means that it is negative.

Example:

("a" or !"b") "c" ("d" or !"e") -> "x"

which means

Replace all occurences of "c" that are preceeded by "a" but not "b" and are followed by "d", but not "e"; with "a".

Below are the complex replacements.

  1. "aww" ("w" or " " or "\n" or ENDOFSTRING) -> "uwu"
  2. "awe" ("some") -> "uwu"
  3. "n" ("a" or "e" or "i" or "o" or "u") -> "ny"
  4. ("o") "wo" (!"w") -> "owo"

Punctuation replacements

Below are the punctuation replacements.

  1. If a sequence of periods ends with " " or "\n", put a random sample from EMOJI or PHRASE depending on the rng result before it.
  2. If a comma is followed by " " or "\n" or ENDOFSTRING, put a random sample from PHRASE before it.
  3. Double all exclamation marks.
  4. Replace each question mark with either "!?" or "?!", depending on the rng result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment