Skip to content

g2p: phoneme-to-grapheme — the inverted tiers (P2G) - #2

Merged
willwade merged 1 commit into
mainfrom
p2g
Aug 23, 2026
Merged

g2p: phoneme-to-grapheme — the inverted tiers (P2G)#2
willwade merged 1 commit into
mainfrom
p2g

Conversation

@willwade

Copy link
Copy Markdown
Contributor

The G2P pipeline is direction-symmetric; spell pronunciations,
including OOV/made-up ones, through the mirrored chain:

  • p2g module: P2g trait (ranked candidates), P2gLexicon (exact
    homophone sets from an inverted FstLexicon), ChainedP2g,
    ByT5P2g (PolyIPA-style seq2seq, onnx feature)
  • PhonetisaurusP2g: reversed-WFST reader reusing the same
    VectorFst parser and Dijkstra search (search over phoneme
    units, '|'-joined compound inputs)
  • FstLexicon::from_rows_raw/lookup_raw: exact-case keys for the
    inverted lexicons (IPA case is significant)
  • floravox-fst-compile --reverse: phoneme-keyed lexicons with
    homophones merged per key (first-seen order)
  • floravox-train-phonetisaurus --reverse: the ilabel/olabel swap
    (the M2M alignment itself is direction-agnostic); holdout eval
    reports homophone-aware exact match + CER
  • floravox-p2g CLI: chain --lexicon/--model/--byt5 tiers

Measured on the published en bundle (124k entries, voicegarden-
lexicons): 39.2% exact / 41.4% homophone-credited / CER 39.7% /
coverage 98.6% — at published Phonetisaurus-P2G baselines; the
inverted lexicon tier answers in-lexicon items exactly.

No existing G2P code paths change (open() was refactored to a
shared table loader; all 48 g2p tests pass unchanged).

The G2P pipeline is direction-symmetric; spell pronunciations,
including OOV/made-up ones, through the mirrored chain:

- p2g module: P2g trait (ranked candidates), P2gLexicon (exact
  homophone sets from an inverted FstLexicon), ChainedP2g,
  ByT5P2g (PolyIPA-style seq2seq, onnx feature)
- PhonetisaurusP2g: reversed-WFST reader reusing the same
  VectorFst parser and Dijkstra search (search over phoneme
  units, '|'-joined compound inputs)
- FstLexicon::from_rows_raw/lookup_raw: exact-case keys for the
  inverted lexicons (IPA case is significant)
- floravox-fst-compile --reverse: phoneme-keyed lexicons with
  homophones merged per key (first-seen order)
- floravox-train-phonetisaurus --reverse: the ilabel/olabel swap
  (the M2M alignment itself is direction-agnostic); holdout eval
  reports homophone-aware exact match + CER
- floravox-p2g CLI: chain --lexicon/--model/--byt5 tiers

Measured on the published en bundle (124k entries, voicegarden-
lexicons): 39.2% exact / 41.4% homophone-credited / CER 39.7% /
coverage 98.6% — at published Phonetisaurus-P2G baselines; the
inverted lexicon tier answers in-lexicon items exactly.

No existing G2P code paths change (open() was refactored to a
shared table loader; all 48 g2p tests pass unchanged).
@willwade
willwade merged commit a1a9107 into main Aug 23, 2026
6 checks passed
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