This commit is contained in:
Slipstream 2025-05-13 11:45:35 -06:00
parent 0a5dc14b04
commit 3078f237f1
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -21,28 +21,40 @@ def _owoify_text(text: str) -> str:
text = re.sub(r'OVE', 'UV', text)
# Extra substitutions
text = re.sub(r'\bth', lambda m: 'd' if random.random() < 0.5 else 'f', text, flags=re.IGNORECASE)
text = re.sub(r'\bthe\b', 'da', text, flags=re.IGNORECASE)
text = re.sub(r'\bthat\b', 'dat', text, flags=re.IGNORECASE)
text = re.sub(r'\bthis\b', 'dis', text, flags=re.IGNORECASE)
text = re.sub(r'\bthose\b', 'dose', text, flags=re.IGNORECASE)
text = re.sub(r'\bthere\b', 'dere', text, flags=re.IGNORECASE)
text = re.sub(r'\bhere\b', 'here', text, flags=re.IGNORECASE) # Intentionally no change, for variety
text = re.sub(r'\bwhat\b', 'whut', text, flags=re.IGNORECASE)
text = re.sub(r'\bwhen\b', 'wen', text, flags=re.IGNORECASE)
text = re.sub(r'\bwhere\b', 'whewe', text, flags=re.IGNORECASE)
text = re.sub(r'\bwhy\b', 'wai', text, flags=re.IGNORECASE)
text = re.sub(r'\bhow\b', 'hau', text, flags=re.IGNORECASE)
text = re.sub(r'\bno\b', 'nu', text, flags=re.IGNORECASE)
text = re.sub(r'\bhas\b', 'haz', text, flags=re.IGNORECASE)
text = re.sub(r'\bhave\b', 'haz', text, flags=re.IGNORECASE)
text = re.sub(r'\byou\b', lambda m: 'u' if random.random() < 0.5 else 'yu', text, flags=re.IGNORECASE)
text = re.sub(r'\byour\b', 'ur', text, flags=re.IGNORECASE)
text = re.sub(r'tion\b', 'shun', text, flags=re.IGNORECASE)
text = re.sub(r'ing\b', 'in', text, flags=re.IGNORECASE)
# Playful punctuation
text = re.sub(r'!', lambda m: random.choice(['!!1!', '! UwU', '! owo', '!! >w<']), text)
text = re.sub(r'!', lambda m: random.choice(['!!1!', '! UwU', '! owo', '!! >w<', '! >//<', '!!?!']), text)
text = re.sub(r'\?', lambda m: random.choice(['?? OwO', '? uwu', '?']), text)
text = re.sub(r'\.', lambda m: random.choice(['~', '.', ' ^w^']), text)
text = re.sub(r'\.', lambda m: random.choice(['~', '.', ' ^w^', ' o.o', ' ._.']), text)
# Stutter (probabilistic, only for words with at least 2 letters)
def stutter_word(match):
word = match.group(0)
if len(word) > 2 and random.random() < 0.25 and word[0].isalpha():
if len(word) > 2 and random.random() < 0.33 and word[0].isalpha(): # Increased probability
return f"{word[0]}-{word}"
return word
text = re.sub(r'\b\w+\b', stutter_word, text)
# Random interjection insertion (after commas or randomly)
interjections = [" owo", " uwu", " >w<", " ^w^", " OwO", " UwU", " >.<", " XD", " nya~", ":3", "(^///^)", "(ᵘʷᵘ)", "(・`ω´・)", ";;w;;"]
interjections = [" owo", " uwu", " >w<", " ^w^", " OwO", " UwU", " >.<", " XD", " nyaa~", ":3", "(^///^)", "(ᵘʷᵘ)", "(・`ω´・)", ";;w;;", " teehee", " hehe", " x3", " rawr", "*nuzzles*", "*pounces*"]
parts = re.split(r'([,])', text)
for i in range(len(parts)):
if parts[i] == ',' or (random.random() < 0.1 and parts[i].strip()):
if parts[i] == ',' or (random.random() < 0.15 and parts[i].strip()): # Increased probability
parts[i] += random.choice(interjections)
text = ''.join(parts)
# Suffix