Skip to content

feat(tn/en): opt-in roman-numeral list markers (roman_enumerators) - #91

Merged
Alex-Wengg merged 1 commit into
mainfrom
feat/tn-en-roman-enumerators
Sep 30, 2026
Merged

Alex-Wengg merged 1 commit into
mainfrom
feat/tn-en-roman-enumerators

Conversation

@Alex-Wengg

Copy link
Copy Markdown
Member

Counterpart of FluidInference/FluidAudio#974 (fixes FluidAudio#972 there).

Kokoro read (i), (ii), (iv) as letters. NeMo's roman grammar is uppercase-only and keyword-anchored, so the compiled FST leaves every list-marker form untouched (verified: (i) … (ii) … (iv), (IV), II. Scope, ii) noise all pass through; only World War II converts).

What — NormalizeOptions::roman_enumerators (default false, same shape as disable_bare_second) + tn::en::roman::spell_enumerators, a port of FluidAudio's EnglishTextNormalizer pre-pass:

  • (ii) anywhere unless glued to a letter (f(x), café(i) stay)
  • ii) / ii. only at line start or after ; : , . + whitespace; dot form only before whitespace (i.e. stays)
  • I V X only, single case, strict form, 1–39 (keeps mix, cd, xl out)
  • markers that aren't self-evident list items (uppercase, lone v/x, all-x) need a second enumerator in the text — (IV) intravenous, checkbox (x), xx. sign-offs, v. Madison, I. M. Pei stand alone; an uppercase outline I. … II. … III. converts whole

Plumbing — tn_normalize_sentence_lang_with_options (rules), fst::normalize_lang{,_with_options} (FST), FFI nemo_tn_fst_with_options + nemo_tn_normalize_sentence_lang_with_options, WASM tnNormalizeSentenceLangWithOptions, Swift wrapper overload, both headers.

Parity — flag off is byte-identical to before on every path: FST parity suite green, nemo_tn_fst untouched, FFI test asserts off == plain.

Reviewer notes

  • Ran: cargo test, cargo test --features ffi,fst-engine (incl. fst_parity), cargo build --target wasm32-unknown-unknown --features wasm, cargo fmt --check.
  • FluidAudio keeps its Swift pre-pass regardless (needed for the trait-off build); this flag is for the WASM/npm and other non-Swift consumers.

🤖 Generated with Claude Code

FluidAudio #972: Kokoro read `(i)`, `(ii)`, `(iv)` as letters. NeMo's roman
grammar is uppercase-only and keyword-anchored, so the compiled FST leaves
every list-marker form untouched (verified: `(i) … (ii) … (iv)`, `(IV)`,
`II. Scope`, `ii) noise` all pass through; only `World War II` converts).

Add `NormalizeOptions::roman_enumerators` (default false, same shape as
`disable_bare_second`) and `tn::en::roman::spell_enumerators`, a port of
FluidAudio's `EnglishTextNormalizer` pre-pass:

- `(ii)` anywhere unless glued to a letter (`f(x)`, `café(i)` stay)
- `ii)` / `ii.` only at line start or after `; : , .` + whitespace; the
  dot form only before whitespace (`i.e.` stays)
- `I V X` only, single case, strict form, 1–39 (keeps `mix`, `cd`, `xl` out)
- markers that aren't self-evident list items (uppercase, lone `v`/`x`,
  all-`x`) need a second enumerator in the text, so `(IV)` intravenous,
  checkbox `(x)`, `xx.` sign-offs, `v. Madison`, `I. M. Pei` stand alone
  while an uppercase outline `I. … II. … III.` converts whole

Plumbing: `tn_normalize_sentence_lang_with_options` (rules engine),
`fst::normalize_lang{,_with_options}` (FST engine), FFI
`nemo_tn_fst_with_options` + `nemo_tn_normalize_sentence_lang_with_options`,
WASM `tnNormalizeSentenceLangWithOptions`, Swift wrapper overload, headers.
With the flag off every path is byte-identical to before (FST parity suite
and `nemo_tn_fst` unchanged; FFI test asserts off == plain).
@Alex-Wengg
Alex-Wengg merged commit 161b9fb into main Sep 30, 2026
8 checks passed
@Alex-Wengg
Alex-Wengg deleted the feat/tn-en-roman-enumerators branch September 30, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant