Disable bestpath for the forced-alignment search - #500
Open
lenzo-ka wants to merge 1 commit into
Open
Conversation
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.
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.
Forced alignment builds an FSG search named
_align. When the globalbestpathoption 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 reportsphone N has impossible duration(state_align_search.c) and the resulting state alignment is corrupted. Thealigncommand 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
bestpathoff for the_alignsearch only, infsg_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_bestpathruns 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.