Keep German domain endings natural in TTS

This commit is contained in:
Mikei386
2026-08-23 13:33:20 +02:00
parent d726afff70
commit 4ae8ab948e
3 changed files with 8 additions and 3 deletions
@@ -89,7 +89,7 @@ class LanguageSegmentationTests(unittest.TestCase):
self.assertIn("Höchstwert 22 Grad, Tiefstwert 10 Grad", spoken)
self.assertIn("0 Prozent Regen", spoken)
self.assertIn("wetter Punkt C O M", spoken)
self.assertIn("wetteronline Punkt D E", spoken)
self.assertIn("wetteronline Punkt de", spoken)
def test_full_date_and_raw_url_are_normalized(self):
spoken = gateway.clean_for_speech(
+5 -1
View File
@@ -259,7 +259,11 @@ def normalize_for_german_speech(text: str) -> str:
r"\.(de|com|org|net|io|ai)\b",
lambda match: (
match.group(1).replace(".", " Punkt ")
+ " Punkt " + " ".join(match.group(2).upper())
+ " Punkt "
+ (
"de" if match.group(2).lower() == "de"
else " ".join(match.group(2).upper())
)
),
text,
flags=re.IGNORECASE,