From 15ce05aa01f86ce129b5b03240b1bd33491042cc Mon Sep 17 00:00:00 2001 From: godeffroy Date: Mon, 14 Sep 2020 14:40:56 +0200 Subject: [PATCH] PR #3279 - Fixed spaces --- .../ctcdecode/ctc_beam_search_decoder.cpp | 4 ++-- native_client/ctcdecode/path_trie.cpp | 4 ++-- native_client/ctcdecode/path_trie.h | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/native_client/ctcdecode/ctc_beam_search_decoder.cpp b/native_client/ctcdecode/ctc_beam_search_decoder.cpp index 7efaaaa1..33238037 100644 --- a/native_client/ctcdecode/ctc_beam_search_decoder.cpp +++ b/native_client/ctcdecode/ctc_beam_search_decoder.cpp @@ -96,7 +96,7 @@ DecoderState::next(const double *probs, if (full_beam && log_prob_c + prefix->score < min_cutoff) { break; } - assert(prefix->is_empty() || prefix->timesteps!=nullptr); + assert(prefix->is_empty() || prefix->timesteps != nullptr); // blank if (c == blank_id_) { @@ -242,7 +242,7 @@ DecoderState::decode(size_t num_results) const output.timesteps = get_history(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 2b572fa8..e68b1ca7 100644 --- a/native_client/ctcdecode/path_trie.cpp +++ b/native_client/ctcdecode/path_trie.cpp @@ -179,11 +179,11 @@ void PathTrie::iterate_to_vec(std::vector& output) { break; } } - if (timesteps == nullptr){ + if (timesteps == nullptr) { timesteps = add_child(previous_timesteps, new_timestep); } } - previous_timesteps=nullptr; + previous_timesteps = nullptr; output.push_back(this); } diff --git a/native_client/ctcdecode/path_trie.h b/native_client/ctcdecode/path_trie.h index 4c8c82b3..92dd288b 100644 --- a/native_client/ctcdecode/path_trie.h +++ b/native_client/ctcdecode/path_trie.h @@ -15,8 +15,8 @@ * It is used to store the timesteps data for the PathTrie below */ template -struct TreeNode{ - TreeNode* parent; +struct TreeNode { + TreeNode* parent; std::vector, godefv::memory::object_pool_deleter_t> >> children; DataT data; @@ -30,7 +30,7 @@ TreeNode* add_child(TreeNode* node, ChildDataT&& data_); template std::vector get_history(TreeNode*); -using TimestepTreeNode=TreeNode; +using TimestepTreeNode = TreeNode; /* Trie tree for prefix storing and manipulating, with a dictionary in * finite-state transducer for spelling correction. @@ -85,10 +85,10 @@ public: float score; float approx_ctc; unsigned int character; - TimestepTreeNode* timesteps=nullptr; + TimestepTreeNode* timesteps = nullptr; // timestep temporary storage for each decoding step. - TimestepTreeNode* previous_timesteps=nullptr; + TimestepTreeNode* previous_timesteps = nullptr; unsigned int new_timestep; PathTrie* parent; @@ -108,21 +108,21 @@ private: // TreeNode implementation template -TreeNode* add_child(TreeNode* node, ChildDataT&& data_){ - static godefv::memory::object_pool_t> tree_node_pool; - node->children.push_back(tree_node_pool.make_unique(node, std::forward(data_))); +TreeNode* add_child(TreeNode* node, ChildDataT&& data_) { + static godefv::memory::object_pool_t> tree_node_pool; + node->children.push_back(tree_node_pool.make_unique(node, std::forward(data_))); return node->children.back().get(); } template -void get_history_helper(TreeNode* tree_node, std::vector* output){ - if(tree_node==nullptr) return; - assert(tree_node->parent != tree_node); +void get_history_helper(TreeNode* tree_node, std::vector* output) { + if (tree_node == nullptr) return; + assert(tree_node->parent != tree_node); get_history_helper(tree_node->parent, output); output->push_back(tree_node->data); } template -std::vector get_history(TreeNode* tree_node){ +std::vector get_history(TreeNode* tree_node) { std::vector output; get_history_helper(tree_node, &output); return output;