-
Notifications
You must be signed in to change notification settings - Fork 4
Break apart codebase #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c039f3e
87dfbad
07ff0c0
1ec8025
324c61b
666ec91
75ecb60
94d325f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| """UwU-ification of text.""" | ||
|
|
||
| from .uwuifier import uwuify | ||
|
|
||
| __all__ = [ | ||
| "uwuify", | ||
| ] |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,69 @@ | ||||||
| """Regex and map constants for uwuification.""" | ||||||
|
|
||||||
| import re | ||||||
|
|
||||||
| REGEX_WORD_REPLACE = re.compile(r"(?<!w)[lr](?!w)") | ||||||
| """A regex that to detect certain characters to change to "w"s.""" | ||||||
|
|
||||||
| REGEX_PUNCTUATION = re.compile(r"[.!?\r\n\t]") | ||||||
| """A regex to detect certain punctuation characters to emotify /(^•ω•^)""" | ||||||
|
|
||||||
| REGEX_TILDE = re.compile(r"(?![^ ])(?<!\B)") | ||||||
| """A regex to find places to add tildes (~) to.""" | ||||||
|
|
||||||
| REGEX_STUTTER = re.compile(r"(\s)([a-zA-Z])") | ||||||
| """A regex to find words to stutter.""" | ||||||
|
|
||||||
| REGEX_NYA = re.compile(r"n([aeou][^aeiou])") | ||||||
| """A regex to detect words with an n before a vowel to nyaify.""" | ||||||
| SUBSTITUTE_NYA = r"ny\1" | ||||||
| """A regex to to nyaify words.""" | ||||||
|
||||||
| """A regex to to nyaify words.""" | |
| """A regex to nyaify words.""" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Replacers.""" |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||||||||
| """Regex replacers.""" | ||||||||||||
|
|
||||||||||||
| from __future__ import annotations | ||||||||||||
|
|
||||||||||||
| import random | ||||||||||||
| from functools import partial | ||||||||||||
| from typing import TYPE_CHECKING | ||||||||||||
|
|
||||||||||||
| if TYPE_CHECKING: | ||||||||||||
| import re | ||||||||||||
|
Comment on lines
+9
to
+10
|
||||||||||||
| if TYPE_CHECKING: | |
| import re | |
| import re | |
| if TYPE_CHECKING: |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,107 @@ | ||||||||||||||||||||||||||
| """Uwuification of text.""" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| from __future__ import annotations | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| import random | ||||||||||||||||||||||||||
| from copy import copy | ||||||||||||||||||||||||||
| from functools import partial | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| from imsosorry.uwuification.replacers.regex import re_sub_maybe | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| from .constants import ( | ||||||||||||||||||||||||||
| EMOJIS, | ||||||||||||||||||||||||||
| REGEX_NYA, | ||||||||||||||||||||||||||
| REGEX_PUNCTUATION, | ||||||||||||||||||||||||||
| REGEX_STUTTER, | ||||||||||||||||||||||||||
| REGEX_TILDE, | ||||||||||||||||||||||||||
| REGEX_WORD_REPLACE, | ||||||||||||||||||||||||||
| SUBSTITUTE_NYA, | ||||||||||||||||||||||||||
| WORD_REPLACE, | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def _stutter_string(text: str) -> str: | ||||||||||||||||||||||||||
| """Repeat the last character in a string.""" | ||||||||||||||||||||||||||
| return f"{text}-{text[-1]}" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def _emoji_string(_text: str) -> str: | ||||||||||||||||||||||||||
| """Return a random emoji.""" | ||||||||||||||||||||||||||
| return f" {random.choice(EMOJIS)} " | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def _tildify_string(_text: str) -> str: | ||||||||||||||||||||||||||
| """Repeat the last character in a string.""" | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| """Repeat the last character in a string.""" | |
| """Return a tilde character.""" |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'minimun' to 'minimum'.
| minimun_processable_length: int = 2, | |
| ) -> str: | |
| """Uwuify a string.""" | |
| contains_alpha = any(char.isalpha() for char in text) | |
| if len(text) < minimun_processable_length and not contains_alpha: | |
| minimum_processable_length: int = 2, | |
| ) -> str: | |
| """Uwuify a string.""" | |
| contains_alpha = any(char.isalpha() for char in text) | |
| if len(text) < minimum_processable_length and not contains_alpha: |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stutter function appears twice in the transforms list. Line 91 calls stutter without the required strength parameter, which will cause a TypeError. Remove line 91 to avoid the error and duplicate transformation.
| stutter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammatical error: 'A regex that to detect' should be 'A regex to detect' (remove 'that').