From c3d6f8d9230d08b430a2da598b67d6ec41ebdd94 Mon Sep 17 00:00:00 2001 From: godeffroy Date: Mon, 31 Aug 2020 08:53:26 +0200 Subject: [PATCH] PR #3279 - replaced tabulations by spaces --- .../ctcdecode/ctc_beam_search_decoder.cpp | 40 +++++++++---------- native_client/ctcdecode/path_trie.cpp | 8 ++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/native_client/ctcdecode/ctc_beam_search_decoder.cpp b/native_client/ctcdecode/ctc_beam_search_decoder.cpp index 823313c8..216adff1 100644 --- a/native_client/ctcdecode/ctc_beam_search_decoder.cpp +++ b/native_client/ctcdecode/ctc_beam_search_decoder.cpp @@ -99,22 +99,22 @@ DecoderState::next(const double *probs, if (prefix->score == -NUM_FLT_INF) { continue; } - if (!prefix->is_empty() && prefix->timesteps.empty()) { - // This should never happen. But we report it if it does. - std::cerr<<"error: non-empty prefix has empty timestep sequence"<is_empty() && prefix->timesteps.empty()) { + // This should never happen. But we report it if it does. + std::cerr<<"error: non-empty prefix has empty timestep sequence"<score; - // combine current path with previous ones with the same prefix - // the blank label comes last, so we can compare log_prob_nb_cur with log_p - if (prefix->log_prob_nb_cur < log_p) { - prefix->timesteps_cur = prefix->timesteps; - } + // combine current path with previous ones with the same prefix + // the blank label comes last, so we can compare log_prob_nb_cur with log_p + if (prefix->log_prob_nb_cur < log_p) { + prefix->timesteps_cur = prefix->timesteps; + } prefix->log_prob_b_cur = log_sum_exp(prefix->log_prob_b_cur, log_p); continue; @@ -122,10 +122,10 @@ DecoderState::next(const double *probs, // repeated character if (c == prefix->character) { - // compute probability of current path + // compute probability of current path float log_p = log_prob_c + prefix->log_prob_nb_prev; - // combine current path with previous ones with the same prefix + // combine current path with previous ones with the same prefix if (prefix->log_prob_nb_cur < log_p) { prefix->timesteps_cur = prefix->timesteps; } @@ -137,11 +137,11 @@ DecoderState::next(const double *probs, auto prefix_new = prefix->get_path_trie(c, log_prob_c); if (prefix_new != nullptr) { - // compute timesteps of current path - std::vector timesteps_new=prefix->timesteps; - timesteps_new.push_back(abs_time_step_); + // compute timesteps of current path + std::vector timesteps_new=prefix->timesteps; + timesteps_new.push_back(abs_time_step_); - // compute probability of current path + // compute probability of current path float log_p = -NUM_FLT_INF; if (c == prefix->character && @@ -172,7 +172,7 @@ DecoderState::next(const double *probs, } } - // combine current path with previous ones with the same prefix + // combine current path with previous ones with the same prefix if (prefix_new->log_prob_nb_cur < log_p) { prefix_new->timesteps_cur = timesteps_new; } @@ -240,10 +240,10 @@ DecoderState::decode(size_t num_results) const for (PathTrie* prefix : prefixes_copy) { Output output; output.tokens = prefix->get_path_vec(); - output.timesteps = prefix->timesteps; + output.timesteps = prefix->timesteps; output.confidence = scores[prefix]; outputs.push_back(output); - if(outputs.size()>=num_returned) break; + if(outputs.size()>=num_returned) break; } return outputs; diff --git a/native_client/ctcdecode/path_trie.cpp b/native_client/ctcdecode/path_trie.cpp index 55a81437..50aca873 100644 --- a/native_client/ctcdecode/path_trie.cpp +++ b/native_client/ctcdecode/path_trie.cpp @@ -101,11 +101,11 @@ PathTrie* PathTrie::get_path_trie(unsigned int new_char, float cur_log_prob_c, b std::vector PathTrie::get_path_vec() { if (parent == nullptr) { - return std::vector{}; + return std::vector{}; } std::vector output_tokens=parent->get_path_vec(); if (character != ROOT_) { - output_tokens.push_back(character); + output_tokens.push_back(character); } return output_tokens; } @@ -166,8 +166,8 @@ void PathTrie::iterate_to_vec(std::vector& output) { score = log_sum_exp(log_prob_b_prev, log_prob_nb_prev); - timesteps = std::move(timesteps_cur); - timesteps_cur.clear(); + timesteps = std::move(timesteps_cur); + timesteps_cur.clear(); output.push_back(this); }