Skip to content

Disable bestpath for the forced-alignment search - #500

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

Disable bestpath for the forced-alignment search#500
lenzo-ka wants to merge 1 commit into
cmusphinx:mainfrom
lenzo-ka:fsg_align_no_bestpath

Conversation

@lenzo-ka

Copy link
Copy Markdown
Contributor

Forced alignment builds an FSG search named _align. When the global bestpath option is enabled — which is the default — that search generates its result from a word lattice instead of the Viterbi backtrace. The lattice segmentation can assign a phone fewer frames than its HMM has emitting states, so the second alignment pass reports phone N has impossible duration (state_align_search.c) and the resulting state alignment is corrupted. The align command already disables bestpath for this reason; a caller using the library alignment API (ps_set_align_text / ps_set_alignment) got no such protection.

This forces bestpath off for the _align search only, in fsg_search_init, so the library alignment path uses the Viterbi backtrace regardless of the global setting. Other FSG, JSGF, and keyword searches are unaffected and keep bestpath.

test_align_bestpath runs both alignment passes over a shipped fixture with bestpath enabled and asserts that no phone receives an impossible duration. It fails against the previous behavior.

This addresses the forced-alignment breakage described in #318. The other concerns raised there — whether bestpath should default off for FSG search generally, and the lattice start/end node construction — are not touched here.

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

Forced alignment builds an FSG search named _align. When the global
bestpath option is enabled, that search generates its result from a word
lattice rather than the Viterbi backtrace, and the lattice segmentation
can assign a phone fewer frames than its HMM has emitting states. The
second alignment pass then reports "impossible duration" and the state
alignment is corrupted. The align command already disables bestpath;
apply the same for the _align search so the library alignment path is
correct regardless of the global setting.

test_align_bestpath runs both alignment passes over a shipped fixture
with bestpath enabled and asserts no phone receives an impossible
duration. It fails against the previous behavior.
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.

1 participant