adjust to pass ci

pull/2/head
Yibing Liu 7 years ago
parent acf2072ed4
commit bdfef747e6

@ -9,7 +9,6 @@
#include "ThreadPool.h"
#include "fst/fstlib.h"
#include "fst/log.h"
#include "decoder_utils.h"
#include "path_trie.h"
@ -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);
}
} // end of loop over prefix
} // end of loop over chars
} // end of loop over vocabulary
prefixes.clear();
// update log probs

@ -27,7 +27,7 @@ std::string ctc_greedy_decoder(
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;
// deduplicate
if ((i == 0) || ((i > 0) && max_idx_vec[i] != max_idx_vec[i - 1])) {

@ -14,7 +14,7 @@
* The decoding result in string
*/
std::string ctc_greedy_decoder(
const std::vector<std::vector<double>> &probs_seq,
const std::vector<std::string> &vocabulary);
const std::vector<std::vector<double>>& probs_seq,
const std::vector<std::string>& vocabulary);
#endif // CTC_GREEDY_DECODER_H

@ -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) {
cum_prob += prob_idx[i].second;
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.begin(), prob_idx.begin() + cutoff_len);
}

@ -2,8 +2,8 @@
#define DECODER_UTILS_H_
#include <utility>
#include "path_trie.h"
#include "fst/log.h"
#include "path_trie.h"
const float NUM_FLT_INF = std::numeric_limits<float>::max();
const float NUM_FLT_MIN = std::numeric_limits<float>::min();

@ -19,9 +19,11 @@ PathTrie::PathTrie() {
character = ROOT_;
exists_ = true;
parent = nullptr;
dictionary_ = nullptr;
dictionary_state_ = 0;
has_dictionary_ = false;
matcher_ = nullptr;
}

@ -19,9 +19,11 @@ Scorer::Scorer(double alpha,
const std::vector<std::string>& vocab_list) {
this->alpha = alpha;
this->beta = beta;
dictionary = nullptr;
is_character_based_ = true;
language_model_ = nullptr;
dictionary = nullptr;
max_order_ = 0;
dict_size_ = 0;
SPACE_ID_ = -1;

Loading…
Cancel
Save