Repository navigation
feat(tn/en): opt-in roman-numeral list markers (roman_enumerators) - #91
Merged
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) noiseall pass through; onlyWorld War IIconverts).What —
NormalizeOptions::roman_enumerators(defaultfalse, same shape asdisable_bare_second) +tn::en::roman::spell_enumerators, a port of FluidAudio'sEnglishTextNormalizerpre-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 Xonly, single case, strict form, 1–39 (keepsmix,cd,xlout)v/x, all-x) need a second enumerator in the text —(IV)intravenous, checkbox(x),xx.sign-offs,v. Madison,I. M. Peistand alone; an uppercase outlineI. … II. … III.converts wholePlumbing —
tn_normalize_sentence_lang_with_options(rules),fst::normalize_lang{,_with_options}(FST), FFInemo_tn_fst_with_options+nemo_tn_normalize_sentence_lang_with_options, WASMtnNormalizeSentenceLangWithOptions, Swift wrapper overload, both headers.Parity — flag off is byte-identical to before on every path: FST parity suite green,
nemo_tn_fstuntouched, FFI test assertsoff == plain.Reviewer notes
cargo test,cargo test --features ffi,fst-engine(incl.fst_parity),cargo build --target wasm32-unknown-unknown --features wasm,cargo fmt --check.🤖 Generated with Claude Code