diff --git a/sherpa-onnx/csrc/transducer-keyword-decoder.cc b/sherpa-onnx/csrc/transducer-keyword-decoder.cc index f31348ea9..af78cb9c2 100644 --- a/sherpa-onnx/csrc/transducer-keyword-decoder.cc +++ b/sherpa-onnx/csrc/transducer-keyword-decoder.cc @@ -152,7 +152,7 @@ void TransducerKeywordDecoder::Decode( if (matched) { float ys_prob = 0.0; int32_t length = best_hyp.ys_probs.size(); - for (int32_t i = 1; i <= matched_state->level; ++i) { + for (int32_t i = 0; i < matched_state->level; ++i) { ys_prob += best_hyp.ys_probs[i]; } ys_prob /= matched_state->level;