Improve German TTS range handling
This commit is contained in:
@@ -247,6 +247,20 @@ def normalize_for_german_speech(text: str) -> str:
|
||||
lambda match: f"{int(match.group(1))} Uhr {int(match.group(2))}",
|
||||
text,
|
||||
)
|
||||
text = re.sub(
|
||||
r"\b([01]?\d|2[0-3])\s*[-‐‑‒–—−]\s*"
|
||||
r"([01]?\d|2[0-3])\s*Uhr\b",
|
||||
lambda match: f"{int(match.group(1))} bis {int(match.group(2))} Uhr",
|
||||
text,
|
||||
flags=re.IGNORECASE,
|
||||
)
|
||||
text = re.sub(
|
||||
r"(-?\d+(?:[,.]\d+)?)[ \t]*°?[ \t]*[-‐‑‒–—−][ \t]*"
|
||||
r"(-?\d+(?:[,.]\d+)?)[ \t]*°[ \t]*(?:C)?",
|
||||
r"\1 bis \2 Grad",
|
||||
text,
|
||||
flags=re.IGNORECASE,
|
||||
)
|
||||
text = re.sub(
|
||||
r"(-?\d+(?:[,.]\d+)?)[ \t]*°[ \t]*(?:C)?[ \t]*/[ \t]*"
|
||||
r"(-?\d+(?:[,.]\d+)?)[ \t]*°[ \t]*(?:C)?",
|
||||
|
||||
Reference in New Issue
Block a user