66from copy import copy
77from functools import partial
88
9- from imsosorry .uwuification .replacers .regex import re_sub , re_sub_maybe
9+ from imsosorry .uwuification .replacers .regex import re_sub_maybe
1010
1111from .constants import (
1212 EMOJIS ,
2020)
2121
2222
23- def stutter_string (text : str ) -> str :
23+ def _stutter_string (text : str ) -> str :
2424 """Repeat the last character in a string."""
2525 return f"{ text } -{ text [- 1 ]} "
2626
2727
28- def emoji_string (_text : str ) -> str :
28+ def _emoji_string (_text : str ) -> str :
2929 """Return a random emoji."""
3030 return f" { random .choice (EMOJIS )} "
3131
3232
33+ def _tildify_string (_text : str ) -> str :
34+ """Repeat the last character in a string."""
35+ return "~"
36+
37+
3338def word_replace (text : str ) -> str :
3439 """Replace words that are keys in the word replacement hash to the values specified."""
3540 for word , replacement in WORD_REPLACE .items ():
@@ -39,27 +44,27 @@ def word_replace(text: str) -> str:
3944
4045def nyaify (text : str ) -> str :
4146 """Nyaify a string by adding a 'y' between an 'n' and a vowel."""
42- return re_sub ( text = text , match_pattern = REGEX_NYA , replace_pattern = SUBSTITUTE_NYA )
47+ return REGEX_NYA . sub ( SUBSTITUTE_NYA , text )
4348
4449
4550def char_replace (text : str ) -> str :
4651 """Replace certain characters with 'w'."""
47- return re_sub ( text = text , match_pattern = REGEX_WORD_REPLACE , replace_pattern = "w" )
52+ return REGEX_WORD_REPLACE . sub ( "w" , text )
4853
4954
5055def stutter (text : str , strength : float ) -> str :
5156 """Add stuttering to a string."""
52- return re_sub_maybe (text = text , pattern = REGEX_STUTTER , text_getter = stutter_string , strength = strength )
57+ return re_sub_maybe (text = text , pattern = REGEX_STUTTER , text_getter = _stutter_string , strength = strength )
5358
5459
5560def emoji (text : str , strength : float ) -> str :
5661 """Replace some punctuation with emoticons."""
57- return re_sub_maybe (text = text , pattern = REGEX_PUNCTUATION , text_getter = emoji_string , strength = strength )
62+ return re_sub_maybe (text = text , pattern = REGEX_PUNCTUATION , text_getter = _emoji_string , strength = strength )
5863
5964
6065def tildify (text : str , strength : float ) -> str :
6166 """Add some tildes to spaces."""
62- return re_sub_maybe (text = text , pattern = REGEX_TILDE , text_getter = lambda _text : "~" , strength = strength )
67+ return re_sub_maybe (text = text , pattern = REGEX_TILDE , text_getter = _tildify_string , strength = strength )
6368
6469
6570def uwuify (
0 commit comments