@@ -53,7 +53,17 @@ void MinimumBayesRisk::MbrDecode() {
5353 }
5454 // build the outputs (time, confidences),
5555 if (R_[q] != 0 || opts_.print_silence ) {
56- one_best_times_.push_back (times_[q][0 ]);
56+ // see which 'item' from the sausage-bin should we select,
57+ // (not necessarily the 1st one when MBR decoding disabled)
58+ int32 s = 0 ;
59+ for (int32 j=0 ; j<gamma_[q].size (); j++) {
60+ if (gamma_[q][j].first == R_[q]) {
61+ s = j;
62+ break ;
63+ }
64+ }
65+ one_best_times_.push_back (times_[q][s]);
66+ // post-process the times,
5767 size_t i = one_best_times_.size ();
5868 if (i > 1 && one_best_times_[i-2 ].second > one_best_times_[i-1 ].first ) {
5969 // It's quite possible for this to happen, but it seems like it would
@@ -76,8 +86,12 @@ void MinimumBayesRisk::MbrDecode() {
7686 one_best_times_[i-1 ].second = right;
7787 }
7888 BaseFloat confidence = 0.0 ;
79- for (int32 j = 0 ; j < gamma_[q].size (); j++)
80- if (gamma_[q][j].first == R_[q]) confidence = gamma_[q][j].second ;
89+ for (int32 j = 0 ; j < gamma_[q].size (); j++) {
90+ if (gamma_[q][j].first == R_[q]) {
91+ confidence = gamma_[q][j].second ;
92+ break ;
93+ }
94+ }
8195 one_best_confidences_.push_back (confidence);
8296 }
8397 }
0 commit comments