Skip to content

Document and test the forced-alignment variant-token contract - #504

Open
lenzo-ka wants to merge 1 commit into
cmusphinx:mainfrom
lenzo-ka:align_variant_contract
Open

Document and test the forced-alignment variant-token contract#504
lenzo-ka wants to merge 1 commit into
cmusphinx:mainfrom
lenzo-ka:align_variant_contract

Conversation

@lenzo-ka

Copy link
Copy Markdown
Contributor

ps_set_align_text() verifies each token with an exact dictionary lookup and builds the alignment FSG from the spelling supplied. This gives forced alignment a useful variant-token contract that was neither documented nor tested:

  • An explicit variant spelling such as a(2) is aligned with only that dictionary entry's pronunciation (in the shipped cmudict-en-us.dict, a is AH and a(2) is EY).
  • A base spelling such as a remains free to use any of its alternate pronunciations.
  • An unknown spelling such as a(99) is rejected, and ps_set_align_text() returns -1.

This documents the contract on ps_set_align_text() and adds tests for it, with no behavior change.

test_align_text_variant checks that an unknown variant returns -1 while a transcript of known base and variant spellings is accepted. test_align_variant_alt inspects the constructed _align FSG: a base token contributes an alternate-pronunciation transition, while an explicit variant token does not.

Fixes #503

Tested on macOS (Apple clang) and Linux x86-64 (GCC 13.3); full unit and regression suite passes on both.

ps_set_align_text() looks up each token with an exact dictionary lookup,
so an explicit pronunciation variant such as "a(2)" is aligned with only
that entry's phones, a base spelling such as "a" remains free to use any
of its alternate pronunciations, and an unknown spelling such as "a(99)"
is rejected. Document this on ps_set_align_text() and add tests for it.

test_align_text_variant checks that an unknown variant returns -1 while a
transcript of known base and variant spellings is accepted.
test_align_variant_alt inspects the constructed alignment FSG: a base
token contributes an alternate-pronunciation transition, while an
explicit variant token does not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Document and test forced-alignment variant-token handling

1 participant