@@ -116,10 +116,10 @@ void GetBootstrapWERInterval(
116116 BaseFloat *mean, BaseFloat *interval) {
117117 BaseFloat wer_accum = 0.0 , wer_mult_accum = 0.0 ;
118118
119- for (int32 i = 0 ; i <= replications; ++i) {
119+ for (int32 i = 0 ; i < replications; ++i) {
120120 int32 num_words = 0 , word_errs = 0 ;
121- for (int32 j = 0 ; j <= edit_word_per_hyp.size (); ++j) {
122- int32 random_pos = kaldi::RandInt (0 , edit_word_per_hyp.size ());
121+ for (int32 j = 0 ; j < edit_word_per_hyp.size (); ++j) {
122+ int32 random_pos = kaldi::RandInt (0 , edit_word_per_hyp.size () - 1 );
123123 word_errs += edit_word_per_hyp[random_pos].first ;
124124 num_words += edit_word_per_hyp[random_pos].second ;
125125 }
@@ -140,10 +140,10 @@ void GetBootstrapWERTwoSystemComparison(
140140 int32 replications, BaseFloat *p_improv) {
141141 int32 improv_accum = 0.0 ;
142142
143- for (int32 i = 0 ; i <= replications; ++i) {
143+ for (int32 i = 0 ; i < replications; ++i) {
144144 int32 word_errs = 0 ;
145- for (int32 j = 0 ; j <= edit_word_per_hyp.size (); ++j) {
146- int32 random_pos = kaldi::RandInt (0 , edit_word_per_hyp.size ());
145+ for (int32 j = 0 ; j < edit_word_per_hyp.size (); ++j) {
146+ int32 random_pos = kaldi::RandInt (0 , edit_word_per_hyp.size () - 1 );
147147 word_errs += edit_word_per_hyp[random_pos].first -
148148 edit_word_per_hyp2[random_pos].first ;
149149 }
0 commit comments