Writing First Labels

Computing Viterbi or forward-backward alignments is rather slow, and often not necessary. Most of the development phases can be done assuming that the alignment remains unchanged. Therefore it is often useful to store the alignment paths in files, and later load them from the files instead of recomputing them. Once in a while we will write new labels, assuming that our recognizer has improved enough to produce a better alignment for the forthcoming development steps. 
 You've done a Viterbi alignment in the previous step of this tutorial. The only thing that is still missing is a loop over all the training data and a command that acutally stores the slignment paths in files. So do the same startup as you did in the previous step, define the same Tcl procedure proc viterbi, and run the following commands. (The full script including the startup can be found in the scripts thread.) 

catch { mkdir labels }

foreach utt [db] {
  puts  "\$utt [viterbi \$utt]"
  path bsave labels/\$utt
}

What the script is doing is creating a subdirectory named labels, runs a loop over all utterances in the database, calling the viterbi alignment for each of them (reporting the alignment score), and then saving the path in a file named after the utterance ID in the the labels-dubdirectory.