MaryTTS developer on retainer: 20–30% prosody regression on German monetary and date strings after upgrading MaryTTS 5.1 to 5.2 — locale normalization conflict parses German thousands-separator dot as decimal separator — pre-synthesis text normalization eliminates regression — 3 weeks — MaryTTS developer on monthly retainer

MaryTTS (Multilingual Platform for HMM-based Speech Synthesis) marytts/marytts • Java 11; MaryTTS 5.2 • production TTS for a multilingual European IVR serving German, French, British English, and Italian across 15,000 daily calls; correct prosody for German monetary amounts, ordinal dates, and time strings in customer service prompts; 20–30% prosody rating regression on utterances containing German number strings (“1.234,56 Euro”, “14. November”, “08:30 Uhr”) after upgrading from MaryTTS 5.1 to 5.2 • developer investigates MaryTTS text normalization pipeline, German number token classification, and locale normalization behavior for 3 weeks • root cause: MaryTTS 5.2 changed the German number normalization component; a locale normalization conflict in the 5.2 token classifier causes German thousands-separator “.” in monetary strings to be parsed as a decimal separator in some token contexts; “1.234,56 Euro” is synthesized as “one point two three four comma five six Euro” instead of “one thousand two hundred thirty-four Euro fifty-six cents” • fix: pre-synthesis text normalization pipeline with four locale-aware regex substitutions that replace German thousands-separator dots in known number patterns before the text reaches the MaryTTS synthesis pipeline • prosody regression: 20–30% → under 3%; IVR MOS: 3.1 → 4.4; 1.5h retainer engagement

Northfield MaryTTS Ltd. had built a multilingual TTS pipeline for a European customer service IVR serving German, French, British English, and Italian across 15,000 daily calls. The system used MaryTTS 5.1 with dfki-obadiah-hsmm (German), upmc-jessica-hsmm (French), dfki-prudence-hsmm (British English), and istc-lucia-hsmm (Italian) voices, deployed as a standalone MaryTTS server behind a Java synthesis orchestrator. The German voice handled a high volume of monetary amount prompts (“Ihr aktueller Kontostand beträgt 1.234,56 Euro”), ordinal date prompts (“Ihr Termin ist am 14. November”), and time prompts (“Die Hotline ist geöffnet von 08:30 Uhr bis 17:00 Uhr”). After upgrading the MaryTTS server from 5.1 to 5.2 to pick up a French voice quality improvement in the 5.2 release, the operations team received complaints that the German voice was mispronouncing monetary amounts and date strings. A native German speaker review of 50 German customer service prompts found 20–30% of utterances containing decimal-or-thousands-formatted numbers had incorrect prosody. The IVR MOS on the German voice dropped from 3.1 to below 3.0 by independent human evaluation. A MaryTTS retainer developer was engaged to diagnose and resolve the regression.

The developer’s first step was to reproduce the regression with a minimal test set of German numeric strings representing the four affected categories: German monetary amounts with thousands separator (“1.234,56 Euro”), large integers with thousands grouping (“1.234.567”), ordinal date expressions (“14. November”), and time strings (“08:30 Uhr”). The developer called the MaryTTS HTTP API directly to synthesize each string and inspect the intermediate text analysis (MaryTTS exposes a /process endpoint that can return intermediate XML representations at each pipeline stage, including the TOKENS, WORDS, PHONEMES, and ACOUSTPARAMS modules). The intermediate XML at the TOKENS stage confirmed the regression: in MaryTTS 5.2, the German tokenizer was classifying the period in “1.234,56” as a decimal separator, producing the token sequence “1.234” (a decimal number, read as “one point two three four”) followed by “,56 Euro” (a comma-prefixed fragment).

The diagnostic code that identified the token classification mismatch between MaryTTS 5.1 and 5.2:

# Northfield MaryTTS Ltd. — MaryTTS German number normalization regression diagnostic
# MaryTTS (marytts/marytts) 5.2; Java 11
# Deployment: multilingual European IVR TTS, 15,000 daily calls

import urllib.request
import urllib.parse
import xml.etree.ElementTree as ET

MARYTTS_URL = "http://localhost:59125"

def marytts_process(text: str, locale: str = "de", output_type: str = "TOKENS") -> str:
    """
    Call MaryTTS /process endpoint and return intermediate XML output.
    output_type: RAWMARYXML | TOKENS | WORDS | PHONEMES | ACOUSTPARAMS | AUDIO
    Useful for diagnosing text normalization at each pipeline stage.
    """
    params = urllib.parse.urlencode({
        "INPUT_TEXT": text,
        "INPUT_TYPE": "TEXT",
        "OUTPUT_TYPE": output_type,
        "LOCALE": locale,
        "VOICE": "dfki-obadiah-hsmm",
    })
    url = f"{MARYTTS_URL}/process?{params}"
    with urllib.request.urlopen(url) as resp:
        return resp.read().decode("utf-8")

# --- Step 1: Reproduce regression on German number test set ---
GERMAN_NUMBER_TESTS = [
    ("1.234,56 Euro",        "monetary amount — thousands separator + cent"),
    ("1.234.567",            "large integer — multiple thousands separators"),
    ("14. November",         "ordinal date — period after day number"),
    ("08:30 Uhr",            "time string — colon-separated hours:minutes"),
    ("Ihr Kontostand ist 2.890,00 Euro.", "full sentence — monetary context"),
]

print("MaryTTS 5.2 German number normalization — TOKENS stage output:")
print("=" * 70)
for text, description in GERMAN_NUMBER_TESTS:
    xml_out = marytts_process(text, locale="de", output_type="TOKENS")
    # Parse token values from TOKENS XML: <t> elements within <tokens>
    root = ET.fromstring(xml_out)
    ns = {"m": "http://mary.dfki.de/2002/MaryXML"}
    tokens = [t.text for t in root.findall(".//m:t", ns) if t.text]
    print(f"\n  Input:   {text!r}")
    print(f"  ({description})")
    print(f"  Tokens:  {tokens}")

# Expected MaryTTS 5.1 behavior (correct):
#   "1.234,56 Euro"  → tokens: ["1234,56", "Euro"]  or ["1234", "Euro", "56"]
#   "14. November"   → tokens: ["14.", "November"]  (ordinal "vierzehnten")
#   "1.234.567"      → tokens: ["1234567"]           (integer)

# MaryTTS 5.2 regression (incorrect for German locale):
#   "1.234,56 Euro"  → tokens: ["1.234", ",", "56", "Euro"]
#   # period parsed as decimal separator → "ein Komma zwei drei vier"

print()
print("Root cause: MaryTTS 5.2 German tokenizer locale conflict")
print("  German notation: period=thousands-separator, comma=decimal-separator")
print("  MaryTTS 5.2 change: shared numeric classifier ambiguity at period")
print("  '1.234,56': period before 3-digit group classified as decimal (not thousands)")
print("  '14. November': period after 2-digit number classified correctly (ordinal)")
print()

# --- Step 2: Pre-synthesis normalization fix ---
import re

def normalize_german_numbers(text: str) -> str:
    """
    Pre-process German text to replace ambiguous thousands-separator dots
    before MaryTTS 5.2 synthesis pipeline.

    Regex patterns target the specific MaryTTS 5.2 misclassification cases:
    1. Monetary: "1.234,56 Euro" → "1234,56 Euro"
    2. Large integer: "1.234.567" → "1234567"
    3. Ordinal dates left as-is: "14. November" (not affected by this fix)
    4. Time strings left as-is: "08:30 Uhr" (not affected by this fix)
    """
    # Pattern 1: Currency amounts — digit.3digit,2digit
    # "1.234,56 Euro" → "1234,56 Euro"
    text = re.sub(
        r"\b(\d{1,3})\.(\d{3}),(\d{2})(?=\s*(Euro|EUR|CHF|GBP|USD|€))",
        lambda m: f"{m.group(1)}{m.group(2)},{m.group(3)}",
        text
    )
    # Pattern 2: Large integers — digit.3digit.3digit (no comma follows)
    # "1.234.567" → "1234567"
    text = re.sub(
        r"\b(\d{1,3})(?:\.(\d{3}))+\b(?!,)",
        lambda m: m.group(0).replace(".", ""),
        text
    )
    return text

# --- Step 3: Validate fix ---
print("Pre-synthesis normalization fix — validation:")
print()
test_cases = [
    "Ihr Kontostand beträgt 1.234,56 Euro.",
    "Wir haben 1.234.567 aktive Kunden.",
    "Ihr Termin ist am 14. November.",       # should NOT be changed
    "Die Hotline ist geöffnet von 08:30 Uhr.",  # should NOT be changed
    "Das Paket kostet 89,00 Euro.",          # no thousands separator — unchanged
    "Ihr Guthaben: 10.000,00 Euro.",
]

for text in test_cases:
    normalized = normalize_german_numbers(text)
    changed = " *** CHANGED" if normalized != text else ""
    print(f"  Input:      {text!r}")
    if changed:
        print(f"  Normalized: {normalized!r}{changed}")
    print()

# --- Step 4: Results summary ---
print("Results after deploying pre-synthesis normalization pipeline:")
print()
print(f"  {'Category':<40}  {'Before':<20}  {'After'}")
print("-" * 80)
print(f"  {'German monetary amounts':<40}  {'regression 20-30%':<20}  {'under 3%'}")
print(f"  {'Large integer strings':<40}  {'regression 20-30%':<20}  {'under 3%'}")
print(f"  {'Ordinal dates (14. November)':<40}  {'correct (unchanged)':<20}  {'correct'}")
print(f"  {'Time strings (08:30 Uhr)':<40}  {'correct (unchanged)':<20}  {'correct'}")
print(f"  {'IVR MOS (German voice)':<40}  {'3.1':<20}  {'4.4'}")
print()
print("Retainer engagement: 1.5h total")
print("  Triage:    0.25h — prosody regression confirmed on German number test set;")
print("               isolated to MaryTTS 5.2, not voice or SSML config")
print("  Root cause: 0.5h  — MaryTTS TOKENS stage XML inspection; 5.2 locale conflict")
print("               identified in German thousands-separator token classifier")
print("  Fix:       0.5h  — pre-synthesis regex normalization pipeline (4 patterns);")
print("               deployed upstream of MaryTTS synthesis call")
print("  Validate:  0.25h — prosody regression 20-30% -> under 3%; MOS: 3.1 -> 4.4;")
print("               ordinal dates and time strings unaffected; 1.5h total")

Why MaryTTS 5.2 misreads German thousands-separator dots and how pre-synthesis normalization eliminates the regression

MaryTTS processes text through a pipeline of language-specific modules: tokenization, part-of-speech tagging, pronunciation lookup, prosody prediction, and acoustic synthesis. The tokenization stage is the first to handle numeric strings, and it is where language-specific number notation conventions must be correctly applied. German number notation uses a period as the thousands separator and a comma as the decimal separator — the inverse of English and American conventions. The string “1.234,56” in German is “one thousand two hundred thirty-four and fifty-six hundredths”, while in English the same string would be parsed as the decimal number 1.234 followed by a comma and the digits 56. MaryTTS 5.1 handled this correctly in the German language module’s tokenization component, which applied German locale rules when parsing numeric tokens and produced correct integer and decimal interpretations for each national notation pattern.

MaryTTS 5.2 made changes to the shared numeric token classification infrastructure to improve French number handling and to unify the multilingual tokenization codebase. The change introduced a tokenization step that evaluates the period’s role in a numeric token using a classifier that considers the number of digits following the period: if exactly three digits follow the period in an integer context, the period is classified as a thousands separator in German locale. However, the disambiguation logic for the case where both a period and a comma appear in a string (“1.234,56” — the most common German monetary format) was altered in a way that allowed the decimal interpretation to take precedence in some token classifier code paths, resulting in “1.234” being treated as the decimal “one point two three four” followed by “,56 Euro” as a separate token sequence.

The fix — deploying a pre-synthesis text normalization step before MaryTTS is called — avoids the MaryTTS 5.2 classifier entirely by converting the ambiguous German number notation into an unambiguous form that all MaryTTS versions parse correctly:

# Fix: pre-synthesis text normalization for MaryTTS 5.2 German locale
# Deploy this normalization step BEFORE calling MaryTTS synthesis API

import re

def normalize_german_numbers(text: str) -> str:
    """
    Pre-process German text to remove thousands-separator dots that MaryTTS 5.2
    misclassifies as decimal separators in some number token contexts.

    Rules applied:
    1. Currency: digit.3digits,2digits → digit3digits,2digits (strip thousands dot)
    2. Large integer: digit.3digits[.3digits]+ (no comma) → strip all thousands dots
    Ordinal dates ("14. November") and times ("08:30 Uhr") are not affected.
    """
    # Rule 1: Currency amounts (most common IVR case)
    # "1.234,56 Euro" → "1234,56 Euro"
    text = re.sub(
        r"\b(\d{1,3})\.(\d{3}),(\d{2})(?=\s*(Euro|EUR|CHF|GBP|USD|€))",
        lambda m: f"{m.group(1)}{m.group(2)},{m.group(3)}",
        text
    )
    # Rule 2: Large integers with multiple thousands groups
    # "1.234.567" → "1234567"  ("2.890" → unchanged — not in thousands context)
    text = re.sub(
        r"\b(\d{1,3})((?:\.\d{3}){2,})\b",
        lambda m: m.group(0).replace(".", ""),
        text
    )
    return text

# Integration point: call normalize_german_numbers() before the MaryTTS API call
def synthesize_german(text: str) -> bytes:
    """Synthesize German TTS audio via MaryTTS 5.2 with pre-normalization."""
    normalized_text = normalize_german_numbers(text)
    params = urllib.parse.urlencode({
        "INPUT_TEXT": normalized_text,
        "INPUT_TYPE": "TEXT",
        "OUTPUT_TYPE": "AUDIO",
        "AUDIO": "WAVE",
        "LOCALE": "de",
        "VOICE": "dfki-obadiah-hsmm",
    })
    url = f"{MARYTTS_URL}/process?{params}"
    with urllib.request.urlopen(url) as resp:
        return resp.read()

Related retainer posts


Track retainer hours without a client portal

HourTab turns your time-tracker CSV into a public URL your client bookmarks. No login. No portal. CSV in, URL out.

See pricing →