Skip to content

Commit

Permalink
Merge pull request #3021 from mozilla/confidence-raw-scores
Browse files Browse the repository at this point in the history
Return raw scores in confidence value (Fixes #3004)
  • Loading branch information
reuben authored May 27, 2020
2 parents 65bbc9a + d548222 commit af4bc31
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions native_client/ctcdecode/ctc_beam_search_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,20 +204,10 @@ DecoderState::decode(size_t num_results) const
std::vector<Output> outputs;
outputs.reserve(num_returned);

// compute aproximate ctc score as the return score, without affecting the
// return order of decoding result. To delete when decoder gets stable.
for (size_t i = 0; i < num_returned; ++i) {
Output output;
prefixes_copy[i]->get_path_vec(output.tokens, output.timesteps);
double approx_ctc = scores[prefixes_copy[i]];
if (ext_scorer_) {
auto words = ext_scorer_->split_labels_into_scored_units(output.tokens);
// remove term insertion weight
approx_ctc -= words.size() * ext_scorer_->beta;
// remove language model weight
approx_ctc -= (ext_scorer_->get_sent_log_prob(words)) * ext_scorer_->alpha;
}
output.confidence = -approx_ctc;
output.confidence = scores[prefixes_copy[i]];
outputs.push_back(output);
}

Expand Down

0 comments on commit af4bc31

Please sign in to comment.