Add special cases for displaying some names
This commit is contained in:
@@ -56,13 +56,32 @@ def clean_title(title: str) -> str:
|
|||||||
parts = title.split(".")
|
parts = title.split(".")
|
||||||
title = parts[-1]
|
title = parts[-1]
|
||||||
|
|
||||||
# Handle special cases for common acronyms
|
# Special cases for service names and common acronyms
|
||||||
acronyms = ["ai", "aws", "api", "vad"]
|
special_cases = {
|
||||||
|
"ai": "AI",
|
||||||
|
"aws": "AWS",
|
||||||
|
"api": "API",
|
||||||
|
"vad": "VAD",
|
||||||
|
"assemblyai": "AssemblyAI",
|
||||||
|
"deepgram": "Deepgram",
|
||||||
|
"elevenlabs": "ElevenLabs",
|
||||||
|
"openai": "OpenAI",
|
||||||
|
"openpipe": "OpenPipe",
|
||||||
|
"playht": "PlayHT",
|
||||||
|
"xtts": "XTTS",
|
||||||
|
"lmnt": "LMNT",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if the entire title is a special case
|
||||||
|
if title.lower() in special_cases:
|
||||||
|
return special_cases[title.lower()]
|
||||||
|
|
||||||
|
# Otherwise, capitalize each word
|
||||||
words = title.split("_")
|
words = title.split("_")
|
||||||
cleaned_words = []
|
cleaned_words = []
|
||||||
for word in words:
|
for word in words:
|
||||||
if word.lower() in acronyms:
|
if word.lower() in special_cases:
|
||||||
cleaned_words.append(word.upper())
|
cleaned_words.append(special_cases[word.lower()])
|
||||||
else:
|
else:
|
||||||
cleaned_words.append(word.capitalize())
|
cleaned_words.append(word.capitalize())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user