From abc687b3b934bf082d9ec9f60283c8f3733a4409 Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Mon, 14 Oct 2019 16:23:06 +0200 Subject: [PATCH] Specify BOS for final scoring at decode if applicable --- native_client/ctcdecode/ctc_beam_search_decoder.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/native_client/ctcdecode/ctc_beam_search_decoder.cpp b/native_client/ctcdecode/ctc_beam_search_decoder.cpp index a5f9cb27..856ca4a2 100644 --- a/native_client/ctcdecode/ctc_beam_search_decoder.cpp +++ b/native_client/ctcdecode/ctc_beam_search_decoder.cpp @@ -170,7 +170,8 @@ DecoderState::decode() const if (!prefix->is_empty() && prefix->character != space_id_) { float score = 0.0; std::vector ngram = ext_scorer_->make_ngram(prefix); - score = ext_scorer_->get_log_cond_prob(ngram) * ext_scorer_->alpha; + bool bos = ngram.size() < ext_scorer_->get_max_order(); + score = ext_scorer_->get_log_cond_prob(ngram, bos) * ext_scorer_->alpha; score += ext_scorer_->beta; scores[prefix] += score; }