chore: auto-commit from dashboard
This commit is contained in:
18
tools/tts.py
18
tools/tts.py
@@ -62,6 +62,24 @@ def looks_romanian(text: str) -> bool:
|
||||
return any(ch in _RO_DIACRITICS for ch in text)
|
||||
|
||||
|
||||
_RO_FOLD_MAP = str.maketrans({
|
||||
"ă": "a", "â": "a", "î": "i", "ș": "s", "ț": "t",
|
||||
"Ă": "A", "Â": "A", "Î": "I", "Ș": "S", "Ț": "T",
|
||||
"ş": "s", "ţ": "t", "Ş": "S", "Ţ": "T",
|
||||
})
|
||||
|
||||
|
||||
def fold_ro_diacritics(text: str) -> str:
|
||||
"""Transliterează diacriticele RO la ASCII (Constanța → Constanta).
|
||||
|
||||
Pentru voice mode pe voci pocket-tts (English-only): un nume propriu sau
|
||||
un cuvânt românesc scăpat într-un răspuns englezesc nu trebuie să schimbe
|
||||
vocea sau să reducă clauza la tăcere — preferința lui Marius (2026-07-11)
|
||||
e continuitatea vocii clonate, cu pronunție aproximativă.
|
||||
"""
|
||||
return text.translate(_RO_FOLD_MAP)
|
||||
|
||||
|
||||
def map_tts_punctuation(text: str) -> str:
|
||||
"""Replace Unicode punctuation with ASCII and strip emoji — NO length cap.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user