Args:
text: Input text to transform
personality: "baby", "toddler", "uwu", or "custom"
cuteness_level: 1-5, controls frequency of embellishments
Returns:
Transformed baby talk text
"""
# Word replacements (significantly expanded)
baby_dict = {
"hello": "hewwo",
"hullo": "hewwo",
"water": "wawa",
"drink": "drinkie",
"mother": "mama",
"father": "dada",
"dad": "dada",
"mom": "mama",
"boat": "boatie",
"rabbit": "wabbit",
"bunny": "bun-bun",
"cat": "kitty",
"kitten": "kitty",
"dog": "doggy",
"puppy": "pup-pup",
"dear": "deawie",
"wonderful": "wuvwy",
"never": "neba",
"before": "befowe",
"mischief": "twouble",
"accident": "oopsie",
"said": "sayed",
"sculls": "oarsies",
"big": "biggie",
"pie": "yummie pie",
"time": "timie",
"names": "namies",
"very": "vewy",
"love": "wuv",
"food": "num-nums",
"eat": "nom-nom",
"sleep": "sweepy",
"tired": "sweepy",
"happy": "happies",
"sad": "saddie",
"angry": "angwy",
"please": "pwease",
"thank": "fank",
"thanks": "fanks",
"yes": "yesh",
"no": "nuh-uh",
"good": "gud",
"bad": "bad-bad",
"sorry": "sowwy",
"little": "widdle",
"small": "smol",
"tiny": "teeny-weeny",
"look": "wook",
"see": "see-see",
"beautiful": "pwetty",
"pretty": "pwetty",
"scary": "scawy",
"frightening": "scawy",
"friend": "fwen",
"baby": "beebee",
"child": "widdle one",
"children": "widdle ones",
"person": "hooman",
"people": "hoomans",
"something": "sumfin",
"anything": "anyfing",
"everything": "evwyfing",
"nothing": "nuffin",
"want": "wanna",
"going to": "gunna",
"going": "goin",
"remember": "memba",
"forget": "forgotted",
"forgot": "forgotted"
}
# Word endings by personality
endings_by_personality = {
"baby": {
"default": "ie",
"consonant": "ie",
"vowel": "wy",
"short": ""
},
"toddler": {
"default": "y",
"consonant": "y",
"vowel": "ey",
"short": ""
},
"uwu": {
"default": "ie",
"consonant": "ie",
"vowel": "wie",
"short": "u"
},
"custom": {
"default": "ie",
"consonant": "ie",
"vowel": "wy",
"short": ""
}
}
# Get the correct endings for selected personality
endings = endings_by_personality.get(personality, endings_by_personality["baby"])
# Function to replace letter combos with baby-talk equivalents
def transform_letters(word):
# Skip short words
if len(word) <= 2:
return word
# Different letter transformations based on personality
if personality == "baby":
word = re.sub(r'(?<!^)[rl]', 'w', word, flags=re.IGNORECASE)
word = re.sub(r'th', 'd', word, flags=re.IGNORECASE)
word = re.sub(r'v', 'b', word, flags=re.IGNORECASE)
elif personality == "toddler":
word = re.sub(r'(?<!^)[rl]', 'w', word, flags=re.IGNORECASE)
word = re.sub(r'th', 'd', word, flags=re.IGNORECASE)
elif personality == "uwu":
word = re.sub(r'[rl]', 'w', word, flags=re.IGNORECASE)
word = re.sub(r'n([aeiou])', 'ny\\1', word, flags=re.IGNORECASE)
word = re.sub(r's', 'sh', word, flags=re.IGNORECASE)
return word
# Add endings to words
def baby_endings(word):
if len(word) <= 3:
return word
# Words that shouldn't get endings
if word.lower() in ["the", "and", "but", "for", "nor", "yet", "so", "at", "by", "to"]:
return word
if personality == "uwu" and random.random() < 0.3:
return word + "-" + word # UwU likes repetition
# Different endings based on word pattern
if word.endswith(("at", "og")):
return word + "gie"
elif word.endswith(("t", "d", "p")):
return word + endings["consonant"]
elif word.endswith(("n", "m")):
return word + "nie"
elif word.endswith(("a", "e", "i", "o", "u")):
return word + endings["vowel"]
# Random chance to add ending based on cuteness level
if random.random() < (cuteness_level * 0.1):
return word + endings["default"]
return word
# Randomized stuttering based on cuteness level
def maybe_stutter(word):
# Only stutter some initial consonants
if len(word) > 2 and word[0].lower() in 'bcdfghjklmnpqrstvwxyz' and random.random() < (cuteness_level * 0.05):
return word[0] + "-" + word
return word
# Add emoticons based on personality and cuteness
def add_emoticons(sentence):
emoticons = {
"baby": ["(✿◠‿◠)", "ʕ•ᴥ•ʔ", "(。・ω・。)", "◕‿◕", "(。◕‿◕。)"],
"toddler": ["(◠‿◠)", "ʕ•ᴥ•ʔ", "(•‿•)"],
"uwu": ["uwu", "owo", ">w<", "^w^", ":3", "nyaa~", "ʕ•ᴥ•ʔ", "(・ω・)"]
}
selected_emoticons = emoticons.get(personality, emoticons["baby"])
if random.random() < (cuteness_level * 0.15):
return sentence + " " + random.choice(selected_emoticons)
return sentence
# Get baby speak interjections by personality
def get_interjections():
interjections = {
"baby": ["Goo goo ga ga!", "Ba ba!", "Gah!", "Agoo!", "Blblblbl!"],
"toddler": ["Oopsie!", "Yay!", "Uh-oh!", "Wow-wee!", "Oh noes!"],
"uwu": ["Uwu~", "Owo~", "Nyaa~", "Waaah~", "*giggles*", "*blushes*"]
}
return interjections.get(personality, interjections["baby"])
# Transform each word
def transform_word(word):
# Skip empty strings
if not word.strip():
return word
# Handle punctuation
match = re.match(r'^(\W*)([\w\'-]*)(\W*)$', word)
if match:
prefix, core, suffix = match.groups()
else:
prefix, core, suffix = '', word, ''
if not core:
return word
lw = core.lower()
# Special case for contractions
if "'" in core:
return prefix + core + suffix
# Dictionary replacement
if lw in baby_dict:
bw = baby_dict[lw]
else:
# Apply transformations
bw = transform_letters(lw)
bw = baby_endings(bw)
bw = maybe_stutter(bw)
# Preserve original capitalization
if core.istitle():
bw = bw.capitalize()
elif core.isupper():
bw = bw.upper()
return prefix + bw + suffix
# Break into sentences
sentences = re.split(r'([.!?]+)', text)
result = []
i = 0
while i < len(sentences):
s = sentences[i]
# Skip empty sentences
if not s.strip():
i += 1
continue
# Process sentence
words = s.split()
baby_words = [transform_word(w) for w in words]
processed = ' '.join(baby_words)
# Add to result
if processed:
processed = add_emoticons(processed)
result.append(processed)
# Add punctuation if it exists
if i + 1 < len(sentences) and sentences[i + 1].strip():
result[-1] += sentences[i + 1]
# Add baby interjections randomly based on cuteness level
if sentences[i + 1].strip() in ['.', '!', '?'] and random.random() < (cuteness_level * 0.12):
result.append(random.choice(get_interjections()))
i += 2
output = ' '.join(result)
return output
Args:
text: Input text to transform
personality: "baby", "toddler", "uwu", or "custom"
cuteness_level: 1-5, controls frequency of embellishments
Returns:
Transformed baby talk text
"""
# Word replacements
baby_dict = {
"hello": "hewwo",
"hullo": "hewwo",
"water": "wawa",
"drink": "drinkie",
"mother": "mama",
"father": "dada",
"dad": "dada",
"mom": "mama",
"boat": "boatie",
"rabbit": "wabbit",
"bunny": "bun-bun",
"cat": "kitty",
"kitten": "kitty",
"dog": "doggy",
"puppy": "pup-pup",
"dear": "deawie",
"wonderful": "wuvwy",
"never": "neba",
"before": "befowe",
"mischief": "twouble",
"accident": "oopsie",
"said": "sayed",
"sculls": "oarsies",
"big": "biggie",
"pie": "yummie pie",
"time": "timie",
"names": "namies",
"very": "vewy",
"love": "wuv",
"food": "num-nums",
"eat": "nom-nom",
"sleep": "sweepy",
"tired": "sweepy",
"happy": "happies",
"sad": "saddie",
"angry": "angwy",
"please": "pwease",
"thank": "fank",
"thanks": "fanks",
"yes": "yesh",
"no": "nuh-uh",
"good": "gud",
"bad": "bad-bad",
"sorry": "sowwy",
"little": "widdle",
"small": "smol",
"tiny": "teeny-weeny",
"look": "wook",
"see": "see-see",
"beautiful": "pwetty",
"pretty": "pwetty",
"scary": "scawy",
"frightening": "scawy",
"friend": "fwen",
"baby": "beebee",
"child": "widdle one",
"children": "widdle ones",
"person": "hooman",
"people": "hoomans",
"something": "sumfin",
"anything": "anyfing",
"everything": "evwyfing",
"nothing": "nuffin",
"want": "wanna",
"going to": "gunna",
"going": "goin",
"remember": "memba",
"forget": "forgotted",
"forgot": "forgotted"
}
# Word endings by personality
endings_by_personality = {
"baby": {
"default": "ie",
"consonant": "ie",
"vowel": "wy",
"short": ""
},
"toddler": {
"default": "y",
"consonant": "y",
"vowel": "ey",
"short": ""
},
"uwu": {
"default": "ie",
"consonant": "ie",
"vowel": "wie",
"short": "u"
},
"custom": {
"default": "ie",
"consonant": "ie",
"vowel": "wy",
"short": ""
}
}
# Get the correct endings for selected personality
endings = endings_by_personality.get(personality, endings_by_personality["baby"])
# Function to replace letter combos with baby-talk equivalents
def transform_letters(word):
# Skip short words
if len(word) <= 2:
return word
# Different letter transformations based on personality
if personality == "baby":
word = re.sub(r'(?<!^)[rl]', 'w', word, flags=re.IGNORECASE)
word = re.sub(r'th', 'd', word, flags=re.IGNORECASE)
word = re.sub(r'v', 'b', word, flags=re.IGNORECASE)
elif personality == "toddler":
word = re.sub(r'(?<!^)[rl]', 'w', word, flags=re.IGNORECASE)
word = re.sub(r'th', 'd', word, flags=re.IGNORECASE)
elif personality == "uwu":
word = re.sub(r'[rl]', 'w', word, flags=re.IGNORECASE)
word = re.sub(r'n([aeiou])', 'ny\\1', word, flags=re.IGNORECASE)
word = re.sub(r's', 'sh', word, flags=re.IGNORECASE)
return word
# Add endings to words
def baby_endings(word):
if len(word) <= 3:
return word
# Words that shouldn't get endings
if word.lower() in ["the", "and", "but", "for", "nor", "yet", "so", "at", "by", "to"]:
return word
if personality == "uwu" and random.random() < 0.3:
return word + "-" + word # UwU likes repetition
# Different endings based on word pattern
if word.endswith(("at", "og")):
return word + "gie"
elif word.endswith(("t", "d", "p")):
return word + endings["consonant"]
elif word.endswith(("n", "m")):
return word + "nie"
elif word.endswith(("a", "e", "i", "o", "u")):
return word + endings["vowel"]
# Random chance to add ending based on cuteness level
if random.random() < (cuteness_level * 0.1):
return word + endings["default"]
return word
# Randomized stuttering based on cuteness level
def maybe_stutter(word):
# Only stutter some initial consonants
if len(word) > 2 and word[0].lower() in 'bcdfghjklmnpqrstvwxyz' and random.random() < (cuteness_level * 0.05):
return word[0] + "-" + word
return word
# Add emoticons based on personality and cuteness
def add_emoticons(sentence):
emoticons = {
"baby": ["(✿◠‿◠)", "ʕ•ᴥ•ʔ", "(。・ω・。)", "◕‿◕", "(。◕‿◕。)"],
"toddler": ["(◠‿◠)", "ʕ•ᴥ•ʔ", "(•‿•)"],
"uwu": ["uwu", "owo", ">w<", "^w^", ":3", "nyaa~", "ʕ•ᴥ•ʔ", "(・ω・)"]
}
selected_emoticons = emoticons.get(personality, emoticons["baby"])
if random.random() < (cuteness_level * 0.15):
return sentence + " " + random.choice(selected_emoticons)
return sentence
# Get baby speak interjections by personality
def get_interjections():
interjections = {
"baby": ["Goo goo ga ga!", "Ba ba!", "Gah!", "Agoo!", "Blblblbl!"],
"toddler": ["Oopsie!", "Yay!", "Uh-oh!", "Wow-wee!", "Oh noes!"],
"uwu": ["Uwu~", "Owo~", "Nyaa~", "Waaah~", "*giggles*", "*blushes*"]
}
return interjections.get(personality, interjections["baby"])
# Transform each word
def transform_word(word):
# Skip empty strings
if not word.strip():
return word
# Handle punctuation
match = re.match(r'^(\W*)([\w\'-]*)(\W*)$', word)
if match:
prefix, core, suffix = match.groups()
else:
prefix, core, suffix = '', word, ''
if not core:
return word
lw = core.lower()
# Special case for contractions
if "'" in core:
return prefix + core + suffix
# Dictionary replacement
if lw in baby_dict:
bw = baby_dict[lw]
else:
# Apply transformations
bw = transform_letters(lw)
bw = baby_endings(bw)
bw = maybe_stutter(bw)
# Preserve original capitalization
if core.istitle():
bw = bw.capitalize()
elif core.isupper():
bw = bw.upper()
return prefix + bw + suffix
# Break into sentences
sentences = re.split(r'([.!?]+)', text)
result = []
i = 0
while i < len(sentences):
s = sentences[i]
# Skip empty sentences
if not s.strip():
i += 1
continue
# Process sentence
words = s.split()
baby_words = [transform_word(w) for w in words]
processed = ' '.join(baby_words)
# Add to result
if processed:
processed = add_emoticons(processed)
result.append(processed)
# Add punctuation if it exists
if i + 1 < len(sentences) and sentences[i + 1].strip():
result[-1] += sentences[i + 1]
# Add baby interjections randomly based on cuteness level
if sentences[i + 1].strip() in ['.', '!', '?'] and random.random() < (cuteness_level * 0.12):
result.append(random.choice(get_interjections()))
i += 2
output = ' '.join(result)
return output