{"slug": "why-ai-models-sometimes-elongate-their-greetings-like-kon-nichiwa", "title": "Why AI Models Sometimes Elongate Their Greetings Like 'Kon'nichiwa~'", "summary": "A developer at forge.workstyle.tech discovered that AI voice models sometimes elongate greetings like 'Kon'nichiwa~' due to a flaw in the corpus generation pipeline. The normalization process, which removes prolongation marks and compresses repeated characters, inadvertently discarded information about stretched endings, making detection impossible. The developer fixed the issue by separating content consistency checks from stretched-ending detection, using raw transcription strings for the latter.", "body_md": "📝 Originally published (in Japanese) at\n\n[forge.workstyle.tech].\n\nWhen I had the trained voice model read \"こんにちは\" (Hello), it stretched the phrase to \"こんにちわぁ.\" There was no instruction to stretch it in the script.\n\nThe feedback was as follows:\n\nFor \"こんにちは,\" it's pronounced as \"こんにちわぁ\" with an accent on the last syllable. It feels like something is mixed in.\n\n\"Something mixed in\" was accurate, and indeed, something was mixed in. The training corpus contained clips with stretched endings.\n\nThe problem was that **the mechanism to detect it was fundamentally non-functional by design**.\n\nIn corpus generation, the audio read by TTS is transcribed using Whisper and then compared with the script.\n\n``` php\ndef _kana(s: str) -> str:\n    # Katakana to Hiragana\n    return \"\".join(chr(ord(c) - 0x60) if \"ァ\" <= c <= \"ヶ\" else c for c in s)\n\n_PUNCT_RE  = re.compile(r\"[、。！？!?…・\\s「」ー〜,\\.]\")\n_REPEAT_RE = re.compile(r\"(.)\\1+\")\n\ndef _collapse(s):\n    return _REPEAT_RE.sub(r\"\\1\", _PUNCT_RE.sub(\"\", s or \"\"))\n\ndef judge_transcript(script_text, transcript, ...):\n    a = _kana(_collapse(script_text))\n    b = _kana(_collapse(transcript))\n    sm = difflib.SequenceMatcher(None, a, b)\n    ...\n```\n\nNormalization is performed before comparison. It’s a straightforward implementation.\n\nHere, look at `_PUNCT_RE`\n\n. Among the characters to be removed is ** ー (prolongation mark)**. And\n\n`_REPEAT_RE`\n\ncompresses consecutive identical characters into one.\n\n```\nScript: こんにちは\nTranscription: こんにちわー\n\nAfter normalization:\n  Script → こんにちは\n  Transcription → こんにちわ      ← The `ー` is removed\n```\n\nThe match rate is high. It becomes a difference of just one character between \"は\" and \"わ.\" **The information that the ending was stretched is discarded during normalization.**\n\nThe same happens with consecutive vowels.\n\n```\nTranscription: こんにちわあ  →  _REPEAT_RE compresses consecutive \"あ\" →  こんにちわ\n```\n\nThis means **this verification cannot detect stretched endings no matter what**. The normalization written to ignore prolongation marks works the same way even when we want to detect them.\n\nThe normalization itself is correct. If the goal is to absorb variations in notation and check for content consistency, prolongation marks should be removed. **The problem was that there was only one normalization for two purposes.**\n\nI separated the judgment for content consistency from the judgment for stretched endings. The latter uses **the raw string before normalization**.\n\n``` python\n_TAIL_LONG_RE = re.compile(r\"[ーぁ-ん]$\")\n\ndef trailing_elongation_mismatch(script_text: str, raw_transcript: str) -> bool:\n    \"\"\"Detects stretched endings not present in the script.\n\n    ⚠️ Pass the raw transcription from Whisper to `raw_transcript`.\n    Kana normalization discards prolongation marks, so detection is impossible with normalized strings.\n    \"\"\"\n    script = (script_text or \"\").rstrip(\"。、！？!? \")\n    trans  = (raw_transcript or \"\").rstrip(\"。、！？!? \")\n    if not script or not trans:\n        return False\n\n    # Check if the last character of the script is \"stretched\" in the transcription\n    tail_script = script[-1]\n    # Prolongation mark exists in transcription but not in script\n    if \"ー\" not in script and trans.endswith(\"ー\"):\n        return True\n    # Consecutive identical vowels exist only in transcription (e.g., \"です\" → \"ですぅ,\" \"ですう\")\n    if len(trans) > len(script) and trans[len(script)-1:].startswith(tail_script):\n        extra = trans[len(script):]\n        if extra and all(c in \"ぁぃぅぇぉあいうえおー\" for c in extra):\n            return True\n    return False\n```\n\nWith the judgments separated, the caller checks them independently.\n\n```\nres  = judge_transcript(text, tr[\"text\"])                  # Content consistency (with normalization)\ntail = trailing_elongation_mismatch(text, tr[\"text\"])      # Stretched endings (raw string)\n\nif tail:\n    continue          # If the ending is stretched, immediately redraw (even if the content matches)\nif res.ok:\n    save(wav)\n```\n\n**Stretched endings are disqualified even if the content matches.** No matter how high the content consistency, if the ending is stretched, it’s not included in the training material. Relaxing this would ingrain the habit.\n\nHowever, setting it to zero completely reduces yield. In emotionally charged speech, some stretching naturally occurs.\n\nUltimately, I used this two-condition OR logic:\n\n``` python\ndef accept(text, transcript):\n    v    = judge_transcript(text, transcript)\n    tail = trailing_elongation_mismatch(text, transcript)\n    return (v.ratio >= 0.82 and tail <= 2) or (v.ratio >= 0.70 and tail == 0)\n```\n\nThis ensures that clips with \"questionable content and stretched endings\" are reliably discarded. It tolerates recognition degradation due to emotional expression while not allowing the stretching habit to pass.\n\nAnother effective measure was **writing it in the caption during generation**.\n\nWhen designing role-specific voices, I included this in the caption:\n\n```\nA female announcer's voice accurately reading a news script. Clear and easy to understand,\nwith a calm, intellectual tone, pronouncing each word distinctly, including the endings.\n```\n\nThe last part, \"**pronouncing each word distinctly, including the endings**,\" was key.\n\nThe effect was clear. Measuring 24 candidates × 5 probe sentences = 120 clips showed **zero stretched endings**. Before the quality gate could reject them, stretched audio simply wasn’t generated.\n\n```\nRole-included caption (distinct endings) → Stretched endings 0/120\n```\n\nThe gate is a mechanism to \"discard bad ones,\" but discarding reduces yield. **If it can be prevented upstream, that’s cheaper.** For TTS that can be instructed via captions, it’s worth writing items the quality gate checks into the caption as well.\n\nAs I pursued this phenomenon, a deeper structure emerged. The desirability of stretched endings **varies by use case**.\n\nSo, I defined \"speech styles\" for each use case and varied the corpus script and quality gate strictness by speech style. For business-style speech, the ending gate is strictly applied; for casual styles, it’s relaxed.\n\nWhat’s important is that **speech style is baked into the corpus and cannot be changed during synthesis** (as discussed in [[speaking-style-is-baked-into-the-corpus|speaking speed cannot be changed after training]]). If you want both \"tight endings\" and \"stretched endings\" for the same voice, **bake two versions with the same design values (caption + seed) but different speech styles**. That’s what I’m doing.\n\n**Separate normalization by purpose.** Normalization for content consistency and normalization for detecting specific anomalies are different. Trying to do both with one normalization causes one to fail.\n\n**Be aware of discarded information.** Including `ー`\n\nin `_PUNCT_RE`\n\nwas the right decision, but a judgment needing that information arose later. Adding comments to normalization about \"what is being discarded\" helps the next person notice.\n\n**It’s cheaper to prevent it upstream.** Discarding at the gate reduces yield. If it can be instructed during generation, hit it there.\n\n**Symptoms appear in model behavior.** Even if the corpus data shows \"a few clips with stretched endings,\" it doesn’t look abnormal. The habit only appears after training and speaking. **Dataset inspection alone is insufficient; a process to confirm post-training output is necessary.**\n\nThis is a record of designing voices from a single caption, manufacturing training corpora, and mass-producing role-specific practical voices. This article is **Part 3: Quality Gate**.\n\n← Previous: [[one-rough-clip-ruins-the-whole-style|One Rough Clip Ruins the Whole Style]]\n\n→ Next: [[the-character-that-broke-the-tts-input|\"少々\" Becomes \"しょも\" — Permitted Character List Was Trimming Japanese]]\n\nAll 18 Articles in the Series\n\nThe insights are summarized in [[Manufacturing Pipeline for Mass-Producing Practical Voices from Diffusion TTS]].", "url": "https://wpnews.pro/news/why-ai-models-sometimes-elongate-their-greetings-like-kon-nichiwa", "canonical_source": "https://dev.to/orca_forge/why-ai-models-sometimes-elongate-their-greetings-like-konnichiwa-ole", "published_at": "2026-09-02 00:53:08+00:00", "updated_at": "2026-09-02 01:22:43.782419+00:00", "lang": "en", "topics": ["machine-learning", "natural-language-processing", "developer-tools"], "entities": ["forge.workstyle.tech", "Whisper"], "alternates": {"html": "https://wpnews.pro/news/why-ai-models-sometimes-elongate-their-greetings-like-kon-nichiwa", "markdown": "https://wpnews.pro/news/why-ai-models-sometimes-elongate-their-greetings-like-kon-nichiwa.md", "text": "https://wpnews.pro/news/why-ai-models-sometimes-elongate-their-greetings-like-kon-nichiwa.txt", "jsonld": "https://wpnews.pro/news/why-ai-models-sometimes-elongate-their-greetings-like-kon-nichiwa.jsonld"}}