提交 bdfef747 编写于 作者: Y Yibing Liu

adjust to pass ci

上级 acf2072e
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "ThreadPool.h" #include "ThreadPool.h"
#include "fst/fstlib.h" #include "fst/fstlib.h"
#include "fst/log.h"
#include "decoder_utils.h" #include "decoder_utils.h"
#include "path_trie.h" #include "path_trie.h"
...@@ -130,7 +129,7 @@ std::vector<std::pair<double, std::string>> ctc_beam_search_decoder( ...@@ -130,7 +129,7 @@ std::vector<std::pair<double, std::string>> ctc_beam_search_decoder(
log_sum_exp(prefix_new->log_prob_nb_cur, log_p); log_sum_exp(prefix_new->log_prob_nb_cur, log_p);
} }
} // end of loop over prefix } // end of loop over prefix
} // end of loop over chars } // end of loop over vocabulary
prefixes.clear(); prefixes.clear();
// update log probs // update log probs
......
...@@ -27,7 +27,7 @@ std::string ctc_greedy_decoder( ...@@ -27,7 +27,7 @@ std::string ctc_greedy_decoder(
max_prob = probs_step[j]; max_prob = probs_step[j];
} }
} }
// id with maximum probability in current step // id with maximum probability in current time step
max_idx_vec[i] = max_idx; max_idx_vec[i] = max_idx;
// deduplicate // deduplicate
if ((i == 0) || ((i > 0) && max_idx_vec[i] != max_idx_vec[i - 1])) { if ((i == 0) || ((i > 0) && max_idx_vec[i] != max_idx_vec[i - 1])) {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* The decoding result in string * The decoding result in string
*/ */
std::string ctc_greedy_decoder( std::string ctc_greedy_decoder(
const std::vector<std::vector<double>> &probs_seq, const std::vector<std::vector<double>>& probs_seq,
const std::vector<std::string> &vocabulary); const std::vector<std::string>& vocabulary);
#endif // CTC_GREEDY_DECODER_H #endif // CTC_GREEDY_DECODER_H
...@@ -23,10 +23,9 @@ std::vector<std::pair<size_t, float>> get_pruned_log_probs( ...@@ -23,10 +23,9 @@ std::vector<std::pair<size_t, float>> get_pruned_log_probs(
for (size_t i = 0; i < prob_idx.size(); ++i) { for (size_t i = 0; i < prob_idx.size(); ++i) {
cum_prob += prob_idx[i].second; cum_prob += prob_idx[i].second;
cutoff_len += 1; cutoff_len += 1;
if (cum_prob >= cutoff_prob) break; if (cum_prob >= cutoff_prob || cutoff_len >= cutoff_top_n) break;
} }
} }
cutoff_len = std::min(cutoff_len, cutoff_top_n);
prob_idx = std::vector<std::pair<int, double>>( prob_idx = std::vector<std::pair<int, double>>(
prob_idx.begin(), prob_idx.begin() + cutoff_len); prob_idx.begin(), prob_idx.begin() + cutoff_len);
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
#define DECODER_UTILS_H_ #define DECODER_UTILS_H_
#include <utility> #include <utility>
#include "path_trie.h"
#include "fst/log.h" #include "fst/log.h"
#include "path_trie.h"
const float NUM_FLT_INF = std::numeric_limits<float>::max(); const float NUM_FLT_INF = std::numeric_limits<float>::max();
const float NUM_FLT_MIN = std::numeric_limits<float>::min(); const float NUM_FLT_MIN = std::numeric_limits<float>::min();
......
...@@ -19,9 +19,11 @@ PathTrie::PathTrie() { ...@@ -19,9 +19,11 @@ PathTrie::PathTrie() {
character = ROOT_; character = ROOT_;
exists_ = true; exists_ = true;
parent = nullptr; parent = nullptr;
dictionary_ = nullptr; dictionary_ = nullptr;
dictionary_state_ = 0; dictionary_state_ = 0;
has_dictionary_ = false; has_dictionary_ = false;
matcher_ = nullptr; matcher_ = nullptr;
} }
......
...@@ -19,9 +19,11 @@ Scorer::Scorer(double alpha, ...@@ -19,9 +19,11 @@ Scorer::Scorer(double alpha,
const std::vector<std::string>& vocab_list) { const std::vector<std::string>& vocab_list) {
this->alpha = alpha; this->alpha = alpha;
this->beta = beta; this->beta = beta;
dictionary = nullptr;
is_character_based_ = true; is_character_based_ = true;
language_model_ = nullptr; language_model_ = nullptr;
dictionary = nullptr;
max_order_ = 0; max_order_ = 0;
dict_size_ = 0; dict_size_ = 0;
SPACE_ID_ = -1; SPACE_ID_ = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册