dfg
This commit is contained in:
parent
1eb1f66a7c
commit
d9eca8b9b6
@ -5,7 +5,8 @@ import re
|
||||
import random
|
||||
|
||||
def _owoify_text(text: str) -> str:
|
||||
"""Helper function to owoify text."""
|
||||
"""Improved owoification with more rules and randomness."""
|
||||
# Basic substitutions
|
||||
text = re.sub(r'[rl]', 'w', text)
|
||||
text = re.sub(r'[RL]', 'W', text)
|
||||
text = re.sub(r'n([aeiou])', r'ny\1', text)
|
||||
@ -13,8 +14,34 @@ def _owoify_text(text: str) -> str:
|
||||
text = re.sub(r'N([AEIOU])', r'NY\1', text)
|
||||
text = re.sub(r'ove', 'uv', text)
|
||||
text = re.sub(r'OVE', 'UV', text)
|
||||
suffixes = [" owo", " uwu", " >w<", " ^w^", " OwO", " UwU", " >.<"]
|
||||
text += random.choice(suffixes)
|
||||
# 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'\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)
|
||||
# Playful punctuation
|
||||
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)
|
||||
# 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():
|
||||
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;;"]
|
||||
parts = re.split(r'([,])', text)
|
||||
for i in range(len(parts)):
|
||||
if parts[i] == ',' or (random.random() < 0.1 and parts[i].strip()):
|
||||
parts[i] += random.choice(interjections)
|
||||
text = ''.join(parts)
|
||||
# Suffix
|
||||
text += random.choice(interjections)
|
||||
return text
|
||||
|
||||
class OwoifyCog(commands.Cog):
|
||||
|
Loading…
x
Reference in New Issue
Block a user