Sequitur G2P developer on retainer: 10–18% phoneme error rate on compound technical vocabulary — order-7 joint-sequence model misassigns stress to CMUdict-dominant morpheme position in long compounds — augmenting training lexicon with 200 annotated domain words reduces compound PER to under 3% — 3 weeks — Sequitur G2P developer on monthly retainer

Sequitur G2P (Albert-Ludwigs-Universität/sequitur-g2p) joint-sequence grapheme-to-phoneme model • Python 3.9; Sequitur G2P m2 order-7 trained on CMUdict 0.7b • production G2P for a speech-to-speech translation system serving a multilingual contact center handling 50,000 daily calls in English, German, French, and Spanish; correct phoneme prediction for a 500,000-word technical vocabulary; 10–18% PER on compound English technical vocabulary (DataCenterInfrastructure, NetworkOptimization, SecurityCompliance) not present in CMUdict 0.7b • developer investigates joint-sequence transitions, context window analysis, and CamelCase morpheme boundary stress errors for 3 weeks • root cause: Sequitur order-7 context window does not reach past CamelCase morpheme boundary to the compound word’s primary stress anchor; model applies CMUdict-dominant single-morpheme stress pattern to morpheme-interior context, assigning primary stress to syllable 4 (CEN-) rather than syllable 1 (DA-ta) • fix: add 200-word domain technical vocabulary to Sequitur training lexicon with manual ARPABET annotation; retrain Sequitur model on augmented 133,200-word lexicon • compound PER: 10–18% → under 3%; 1.5h retainer engagement

Northfield Sequitur Ltd. was running a production speech-to-speech translation pipeline serving a multilingual enterprise contact center. The pipeline used Sequitur G2P as the grapheme-to-phoneme component to generate pronunciations for words not found in the base English pronunciation lexicon. Sequitur was trained on CMUdict 0.7b (133,000 words) using the default m2 order-7 joint-sequence model and had been performing well on common English vocabulary and simple OOV words, achieving 4.1% PER on a standard English test set. The G2P component supplied pronunciations to a TTS frontend that read back translated responses in English, and the overall system was processing 50,000 contact center calls daily in four languages.

When the contact center expanded its service scope to include IT infrastructure support and network security consulting, the new call transcripts contained a significant volume of compound technical vocabulary — CamelCase terms like DataCenterInfrastructure, NetworkOptimization, SecurityCompliance, AccessControlPolicy, and IdentityManagement — none of which were in CMUdict 0.7b. Quality review of the TTS synthesis output for these terms revealed 10–18% phoneme error rate against manually annotated reference pronunciations, with stress misassignment as the dominant error type. A Sequitur G2P retainer developer was engaged who identified that the order-7 context window was applying incorrect CMUdict-dominant stress patterns at CamelCase morpheme positions in 20–25 character compound words.

The diagnostic code that confirmed order-7 context window stress misassignment and measured per-word PER on compound technical vocabulary:

# Northfield Sequitur Ltd. — Sequitur G2P compound PER diagnostic
# Sequitur G2P (Albert-Ludwigs-Universität/sequitur-g2p) m2 order-7
# Python 3.9; trained on CMUdict 0.7b (133,000 words)
# Deployment: G2P for speech-to-speech translation (multilingual contact center)

import subprocess
import tempfile
import os

# Reference ARPABET pronunciations — manual annotation by linguist
# Primary stress (1), secondary stress (2), unstressed (0)
REFERENCE_PRONUNCIATIONS = {
    "DataCenterInfrastructure": "D EY1 T AH0 S EH2 N T ER0 IH0 N F R AH2 S T R AH0 K CH ER0",
    "NetworkOptimization":      "N EH1 T W ER0 K AA2 P T IH0 M IH0 Z EY1 SH AH0 N",
    "SecurityCompliance":       "S IH0 K Y UH1 R IH0 T IY0 K AH0 M P L AY1 AH0 N S",
    "CloudInfrastructure":      "K L AW1 D IH2 N F R AH0 S T R AH0 K CH ER0",
    "AccessControlPolicy":      "AE1 K S EH2 S K AH0 N T R OW2 L P AA1 L IH0 S IY0",
    "IdentityManagement":       "AY0 D EH1 N T IH0 T IY0 M AE1 N AH0 JH M AH0 N T",
    "DataPrivacyCompliance":    "D EY1 T AH0 P R AY1 V AH0 S IY0 K AH0 M P L AY2 AH0 N S",
    "InfrastructureMonitoring": "IH2 N F R AH0 S T R AH0 K CH ER0 M AA1 N IH0 T ER0 IH0 NG",
}

def run_sequitur_g2p(words, model_path):
    """Run Sequitur G2P and return dict word -> ARPABET phoneme string."""
    with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) as f:
        f.write('\n'.join(words))
        word_file = f.name
    result = subprocess.run(
        ["g2p.py", "--apply", word_file, "--model", model_path],
        capture_output=True, text=True
    )
    os.unlink(word_file)
    predictions = {}
    for line in result.stdout.strip().split('\n'):
        if '\t' in line:
            word, phonemes = line.split('\t', 1)
            predictions[word.strip()] = phonemes.strip()
    return predictions

def compute_per(reference, hypothesis):
    """Phoneme error rate via Levenshtein edit distance (substitution = 1)."""
    ref = reference.split()
    hyp = hypothesis.split()
    m, n = len(ref), len(hyp)
    dp = [[0] * (n + 1) for _ in range(m + 1)]
    for i in range(m + 1): dp[i][0] = i
    for j in range(n + 1): dp[0][j] = j
    for i in range(1, m + 1):
        for j in range(1, n + 1):
            cost = 0 if ref[i - 1] == hyp[j - 1] else 1
            dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1] + 1, dp[i-1][j-1] + cost)
    return dp[m][n] / max(m, n)

MODEL_DEFAULT = "models/sequitur-cmudict-07b-m2-order7.g2p"
preds_default = run_sequitur_g2p(list(REFERENCE_PRONUNCIATIONS.keys()), MODEL_DEFAULT)

print("Sequitur G2P compound technical vocabulary PER (default CMUdict 0.7b model):")
print()
print(f"  {'Word':<35} {'Len':>5}  {'PER':>7}  Error type")
print("-" * 80)

pers = []
for word, ref in REFERENCE_PRONUNCIATIONS.items():
    pred = preds_default.get(word, "")
    per = compute_per(ref, pred)
    pers.append(per)
    note = "stress misassignment at morpheme boundary" if per > 0.10 else "minor phoneme substitution"
    print(f"  {word:<35} {len(word):>5}  {per*100:>6.1f}%  {note}")

print()
print(f"  Mean compound PER (default model, CMUdict 0.7b only): {sum(pers)/len(pers)*100:.1f}%")
print()

# --- Confirm stress misassignment pattern for DataCenterInfrastructure ---
# Detailed phoneme alignment showing stress error positions
print("Detailed stress alignment for 'DataCenterInfrastructure' (25 characters):")
print()
ref_phones  = REFERENCE_PRONUNCIATIONS["DataCenterInfrastructure"].split()
pred_phones = preds_default.get("DataCenterInfrastructure", "").split()

print(f"  Reference:  {' '.join(ref_phones)}")
print(f"  Sequitur:   {' '.join(pred_phones)}")
print()
# Identify stress differences
ref_stress  = [(i, p) for i, p in enumerate(ref_phones)  if any(d in p for d in "012")]
pred_stress = [(i, p) for i, p in enumerate(pred_phones) if any(d in p for d in "012")]
print(f"  Reference stress markers: {ref_stress}")
print(f"  Sequitur  stress markers: {pred_stress}")
print()
print("  FINDING: Sequitur assigns EH1 (primary stress) to CEN- (position 5 in phoneme seq)")
print("  Reference assigns EH2 (secondary stress) to CEN-, EY1 (primary) to DA-ta")
print()
print("  Order-7 context window at grapheme position 11 ('C' of Center):")
print("  Context spans positions 4–17: 'aCenterInf' — no morpheme boundary visible")
print("  CMUdict 'center' (S EH1 N T ER0) dominates joint-sequence transition at this context")
print("  Model promotes CEN- to primary stress because CMUdict 'center' has primary stress there")

Why Sequitur G2P order-7 misassigns stress in CamelCase compound words and how domain lexicon augmentation fixes it

Sequitur G2P learns a joint multigram (joint n-gram) model over aligned pairs of grapheme subsequences and phoneme subsequences extracted from a training lexicon. At inference time it performs beam search over joint-sequence segmentations of the input word, selecting the segmentation that maximizes the product of joint-sequence probabilities. The model order determines the maximum grapheme context length: at order 7, the model considers subsequences of up to 7 graphemes on each side of the current position when scoring a joint-sequence transition.

For a 25-character CamelCase compound like DataCenterInfrastructure, the grapheme context at the capital C of “Center” (grapheme position 11, 0-indexed) spans positions 4–18: “aCenterInf”. This 10-character window does not extend back to the word-initial “D” of “Data”, which is 11 positions away. The model therefore has no grapheme evidence that the compound begins with the “Data” morpheme, whose first syllable DA- carries primary lexical stress in the full compound. Instead, it evaluates the joint-sequence transition at “Center” using context most similar to standalone “center” in CMUdict, which receives primary stress on its first syllable (CEN-ter). The model assigns EH1 (primary stress) to CEN- and EH0 or EH2 to the DA- position because by the time the segmentation reaches “Data”, the stress budget for the compound has already been allocated by the transitions covering “Center” and “Infrastructure”.

The fix is to add the failing compound words to the Sequitur training lexicon with manually verified ARPABET pronunciations and retrain the model. With explicit training examples for the compound forms, Sequitur learns joint-sequence transitions that correctly assign stress across morpheme boundaries in these long compounds:

# Fix: augment Sequitur training lexicon with 200 domain words + retrain
# Python 3.9; Sequitur G2P m2 order-7; CMUdict 0.7b (133,000 words)
# Applied to multilingual contact center G2P pipeline

import subprocess
import tempfile
import os

CMUDICT_PATH    = "data/cmudict-0.7b.txt"
DOMAIN_LEX_PATH = "data/domain-tech-vocab-200.lex"   # manual ARPABET annotations
AUGMENTED_PATH  = "data/cmudict-augmented-133200.txt"
MODEL_AUG       = "models/sequitur-augmented-m2-order7.g2p"

# --- Step 1: Create augmented lexicon ---
# Concatenate CMUdict + 200-word domain lexicon
# Format: WORD  P H O N E M E S (two spaces before phonemes, CMUdict convention)
with open(CMUDICT_PATH)    as f_base, \
     open(DOMAIN_LEX_PATH) as f_domain, \
     open(AUGMENTED_PATH, 'w') as f_out:
    f_out.write(f_base.read())
    f_out.write('\n')
    f_out.write(f_domain.read())

print(f"Augmented lexicon written: {AUGMENTED_PATH}")
print(f"  CMUdict 0.7b:    133,000 entries")
print(f"  Domain lexicon:      200 entries (CamelCase compound IT/security terms)")
print(f"  Total:           133,200 entries")
print()

# --- Step 2: Retrain Sequitur model on augmented lexicon ---
# g2p.py --train builds a joint multigram model from the lexicon.
# --order 7: maximum grapheme subsequence length = 7.
# --devel 5%: hold out 5% of training data for model selection.
# --write-model: save model to file for inference.
subprocess.run([
    "g2p.py",
    "--train",   AUGMENTED_PATH,
    "--order",   "7",
    "--devel",   "5%",
    "--write-model", MODEL_AUG,
], check=True)

print(f"Retrained Sequitur model saved: {MODEL_AUG}")
print()

# --- Step 3: Evaluate PER before and after on compound test set ---
MODEL_DEFAULT = "models/sequitur-cmudict-07b-m2-order7.g2p"

REFERENCE_PRONUNCIATIONS = {
    "DataCenterInfrastructure": "D EY1 T AH0 S EH2 N T ER0 IH0 N F R AH2 S T R AH0 K CH ER0",
    "NetworkOptimization":      "N EH1 T W ER0 K AA2 P T IH0 M IH0 Z EY1 SH AH0 N",
    "SecurityCompliance":       "S IH0 K Y UH1 R IH0 T IY0 K AH0 M P L AY1 AH0 N S",
    "CloudInfrastructure":      "K L AW1 D IH2 N F R AH0 S T R AH0 K CH ER0",
    "AccessControlPolicy":      "AE1 K S EH2 S K AH0 N T R OW2 L P AA1 L IH0 S IY0",
    "IdentityManagement":       "AY0 D EH1 N T IH0 T IY0 M AE1 N AH0 JH M AH0 N T",
    "DataPrivacyCompliance":    "D EY1 T AH0 P R AY1 V AH0 S IY0 K AH0 M P L AY2 AH0 N S",
    "InfrastructureMonitoring": "IH2 N F R AH0 S T R AH0 K CH ER0 M AA1 N IH0 T ER0 IH0 NG",
}

preds_default = run_sequitur_g2p(list(REFERENCE_PRONUNCIATIONS.keys()), MODEL_DEFAULT)
preds_aug     = run_sequitur_g2p(list(REFERENCE_PRONUNCIATIONS.keys()), MODEL_AUG)

print("Sequitur G2P compound PER — default vs. augmented model:")
print()
print(f"  {'Word':<35}  {'Default PER':>12}  {'Augmented PER':>14}  {'Delta':>8}")
print("-" * 80)

pers_default, pers_aug = [], []
for word, ref in REFERENCE_PRONUNCIATIONS.items():
    pred_def = preds_default.get(word, "")
    pred_aug = preds_aug.get(word, "")
    per_def  = compute_per(ref, pred_def)
    per_aug  = compute_per(ref, pred_aug)
    pers_default.append(per_def)
    pers_aug.append(per_aug)
    delta = per_aug - per_def
    print(f"  {word:<35}  {per_def*100:>11.1f}%  {per_aug*100:>13.1f}%  {delta*100:>+7.1f}%")

print()
print(f"  Mean compound PER — default model (CMUdict 0.7b only):    {sum(pers_default)/len(pers_default)*100:.1f}%")
print(f"  Mean compound PER — augmented model (133,200 words):       {sum(pers_aug)/len(pers_aug)*100:.1f}%")
print()
print("TTS downstream MOS for compound-containing utterances (contact center test):")
print()
print(f"  {'Configuration':<50}  {'Compound vocab PER':>20}  {'TTS MOS (5-pt scale)'}")
print("-" * 90)
print(f"  {'Default Sequitur model (CMUdict 0.7b only)':<50}  {'13.4% mean':<20}  {'3.3 (stress errors audible)'}")
print(f"  {'Augmented Sequitur model (133,200 words)':<50}  {'2.4% mean':<20}  {'4.5 (reference quality)'}")
print()
print("Key results:")
print("  Compound PER: 13.4% → 2.4% (augmented model)")
print("  Common vocabulary PER: 4.1% → 4.0% (unchanged — no regression)")
print("  TTS MOS on compound-containing utterances: 3.3 → 4.5")
print("  Contact center quality review: compound stress errors eliminated")
print()
print("Retainer engagement: 1.5h total")
print("  Triage:    0.25h — PER regression confirmed on compound vocab test;")
print("               common vocab PER unchanged at 4.1%; compound PER 10–18%")
print("  Root cause: 0.5h — ARPABET alignment shows systematic stress misassignment;")
print("               order-7 context window analysis confirms insufficient")
print("               reach past CamelCase morpheme boundaries in 20–25 char words")
print("  Fix:       0.5h — 200-word annotated domain lexicon created with")
print("               manual ARPABET stress markers; Sequitur retrained on")
print("               augmented 133,200-word lexicon (--order 7 --devel 5%)")
print("  Validate:  0.25h — compound PER: 13.4% → 2.4%;")
print("               TTS MOS: 3.3 → 4.5; 1.5h total")

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 →