Clarify German TTS timezone acronyms and technical log values

This commit is contained in:
Mikei386 committed 2026-10-21 13:45:53 +02:00
1 parent e8bb28a58f
commit 6d61aa5203
6 files changed
+78

No files matched your search

+6
View File
@@ -75,6 +75,12 @@ Full fresh-host restore qualification remains open; this live limit check is not
an end-to-end restore test. Rollback is the same live Docker update plus manifest
fields set to the former 44g values, only after ensuring usage fits the lower cap.
## Technical TTS clarification · 21 October 2026
Explicit timezone letters, audio format names, known literal log fields, numeric
seconds and paired bitrate values are covered by 37 passing preparation/routing
tests. [Scope, validation and restore](maintenance/2026-10-21-tts-technical.md).
## Technical TTS vocabulary · 19 October 2026
Central speech preparation now distinguishes MB/MiB/Mbit and rate suffixes,
@@ -0,0 +1,30 @@
# Technical speech clarification · 21 October 2026
Shared German speech preparation adds explicit letter names for CEST, CET, UTC,
MESZ, MEZ, MP3/mp3 and PCM. API/MCP is spoken as two letter sequences.
Known literal log fields (transcoding, format, tracksImported, tracksMissing,
RestartCount) receive spoken labels and explicit values: false remains falsch,
true remains wahr, raw becomes unverändert. This never infers service health.
Numeric seconds are expanded; paired bit rates repeat the unit on both numbers
(128/256 kbps → 128 Kilobit pro Sekunde oder 256 Kilobit pro Sekunde).
The optional shared endpoint enhancer applies technical normalization again after
removing inline backticks, so inline log fields are included. URL, path, filename
and entity-ID protections remain; no arbitrary code interpreter or LLM is added.
Rules remain idempotent and German-only. No displayed message or Mac app changes.
No attempt is made to phoneticize every product name or guarantee TTS fidelity.
Verification: 37 tests pass with
`python3 -m unittest test_speech_text test_tts_text_enhancer test_speech_mp3 test_speech_reference`.
The user's entire Navidrome report was prepared offline; private input/audio stay
outside version control. Live synthesis/STT validation is recorded after activation.
Operation: speech_text.py and tts_text_enhancer.py already belong to the installer
allowlist. On this deployment, update the canonical source then use the existing
installer update with reuse-runtime. Check endpoint active/queued requests before
stopping; do not interrupt active work. Existing profiles, weights, voice and
endpoint settings are retained. Normal rollback uses the previous image.
Native Debian uses the same application modules, without additional packages,
with an application restart in an idle maintenance window. Restore requires this
revision plus the existing private state/voice restore package. Fresh-Debian full
restore qualification remains an existing open platform task.
+18
View File
@@ -172,6 +172,10 @@ def prepare_technical_german(text: str) -> str:
'μs': 'Mikrosekunden', 'ns': 'Nanosekunden',
}
vocab = {
'CEST': 'Ce E Es Te', 'CET': 'Ce E Te', 'UTC': 'U Te Ce',
'MESZ': 'Em E Es Zett', 'MEZ': 'Em E Zett',
'MP3': 'Em Pe drei', 'mp3': 'Em Pe drei', 'PCM': 'Pe Ce Em',
'API/MCP': 'A Pe I und Em Ce Pe',
'CPU': 'Ce Pe U', 'GPU': 'Ge Pe U', 'RAM': 'Arbeitsspeicher',
'VRAM': 'Grafikspeicher', 'SSD': 'Es Es De', 'HDD': 'Ha De De',
'NVMe': 'En Vau Em E', 'USB': 'U Es Be', 'PCIe': 'Pe Ce I Express',
@@ -199,6 +203,20 @@ def prepare_technical_german(text: str) -> str:
# B/s and bit/s are only meaningful as units after a numeric quantity.
unit_pattern = '|'.join(re.escape(k) for k in sorted(units, key=len, reverse=True))
def prose(value):
# Restrict log-field rules to known names and literal values.
fields = {'transcoding': 'Transkodierung', 'format': 'Format',
'tracksImported': 'importierte Titel', 'tracksMissing': 'fehlende Titel',
'RestartCount': 'Neustarts'}
value = re.sub(
r'(?<![\w./@-])(' + '|'.join(fields) + r')\s*(?:=|:)\s*(false|true|raw|\d+)(?!\w|\.\w)',
lambda m: fields[m[1]] + ' gleich ' +
{'false': 'falsch', 'true': 'wahr', 'raw': 'unverändert'}.get(m[2], m[2]), value)
value = re.sub(
r'(?<![\w./-])(\d+)\s*/\s*(\d+)\s*(kbps|Kbps|Mbps|Gbps|Tbps)\b',
lambda m: m[1] + ' ' + m[3] + ' oder ' + m[2] + ' ' + m[3], value)
value = re.sub(
r'(?<![\w./-])(\d+(?:[,.]\d+)?)\s+s\b(?![\w/]|\.[\w])',
lambda m: m[1] + ' Sekunden', value)
value = re.sub(
r'(?<![\w./-])(\d+(?:[,.]\d+)?)\s*(kWh|Wh|kW|W|mV|V|mA|A)(?![\w/-]|\.[\w])',
lambda m: m[1] + ' ' + {'kWh': 'Kilowattstunden', 'Wh': 'Wattstunden',
+13
View File
@@ -4,6 +4,19 @@ from tts_worker import spoken_chunks
class SpeechPreparationTests(unittest.TestCase):
def test_log_punctuation_and_combined_acronyms(self):
self.assertEqual(prepare_technical_german('tracksMissing=0. RestartCount: 0, API/MCP mp3.'),
'fehlende Titel gleich 0. Neustarts gleich 0, A Pe I und Em Ce Pe Em Pe drei.')
def test_timezones_and_audio_formats(self):
self.assertEqual(prepare_for_speech('CEST CET UTC MESZ MEZ MP3 PCM'),
'Ce E Es Te Ce E Te U Te Ce Em E Es Zett Em E Zett Em Pe drei Pe Ce Em')
def test_log_fields_rates_and_seconds(self):
raw='transcoding=false format=raw tracksImported=0 tracksMissing=0; 128/256 kbps; 1,87 s'
expected='Transkodierung gleich falsch Format gleich unverändert importierte Titel gleich 0 fehlende Titel gleich 0; 128 Kilobit pro Sekunde oder 256 Kilobit pro Sekunde; 1,87 Sekunden'
self.assertEqual(prepare_technical_german(raw),expected)
self.assertEqual(prepare_technical_german(expected),expected)
protected='`transcoding=false` /config/CEST https://host/UTC sensor.CEST fooCEST CEST.log'
self.assertEqual(prepare_technical_german(protected),protected)
def test_technical_units_distinguish_bits_bytes_and_binary(self):
cases={'32GB':'32 Gigabyte','32 GiB':'32 Gibibyte','512MiB':'512 Mebibyte',
'16 MB/s':'16 Megabyte pro Sekunde','16 Mb/s':'16 Megabit pro Sekunde',
+9
View File
@@ -6,6 +6,15 @@ from endpoint import APIHandler,Endpoint,APIError
from tts_text_enhancer import prepare
class PreparationTests(unittest.TestCase):
def test_inline_technical_fields_and_timezone(self):
raw='11:42 CEST: `transcoding=false`, `format=raw` (mp3, 128/256 kbps), 1,87 s.'
spoken=prepare(raw)
self.assertIn('Ce E Es Te',spoken)
self.assertIn('Transkodierung gleich falsch',spoken)
self.assertIn('Format gleich unverändert',spoken)
self.assertIn('128 Kilobit pro Sekunde oder 256 Kilobit pro Sekunde',spoken)
self.assertIn('1,87 Sekunden',spoken)
self.assertEqual(prepare(spoken),spoken)
def test_technical_units_at_shared_endpoint(self):
self.assertEqual(prepare('Unraid: 32 GiB RAM, 120 MB/s, 1 Gbit/s.'),
'Anraid: 32 Gibibyte Arbeitsspeicher, 120 Megabyte pro Sekunde, 1 Gigabit pro Sekunde.')
+2
View File
@@ -30,6 +30,8 @@ def prepare(text, language='German'):
text = re.sub(r'^\s*[-*+]\s+', '', text, flags=re.M)
text = re.sub(r'\*\*(.*?)\*\*', r'\1', text, flags=re.S)
text = text.replace('`', '').replace('≠', ' ist nicht gleich ')
# Speak inline log fields too, after their markup has been removed.
text = prepare_technical_german(text)
text = re.sub(r'\bKI\b', 'Künstliche Intelligenz', text)
text = re.sub(r'\bHTTP\b', 'Ha Te Te Pe', text)
text = re.sub(r'\b403\b', 'vierhundertdrei', text)