diff options
author | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-04-30 08:05:11 +0300 |
---|---|---|
committer | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-04-30 08:05:11 +0300 |
commit | eca582410006443d0b101a9ae188e302f34f8a03 (patch) | |
tree | 35212762fbe666330205e2a9ef09d16a918d077c /search | |
parent | 85acdc62b1548863a6db18bebb538406cfcfa038 (diff) |
Remove trailing whitespace in C++ files.
Diffstat (limited to 'search')
-rw-r--r-- | search/applied.hh | 12 | ||||
-rw-r--r-- | search/config.hh | 2 | ||||
-rw-r--r-- | search/edge.hh | 8 | ||||
-rw-r--r-- | search/edge_generator.cc | 12 | ||||
-rw-r--r-- | search/header.hh | 2 | ||||
-rw-r--r-- | search/nbest.cc | 4 | ||||
-rw-r--r-- | search/nbest.hh | 6 | ||||
-rw-r--r-- | search/rule.hh | 4 | ||||
-rw-r--r-- | search/types.hh | 2 | ||||
-rw-r--r-- | search/vertex.cc | 4 | ||||
-rw-r--r-- | search/vertex.hh | 4 | ||||
-rw-r--r-- | search/vertex_generator.hh | 6 |
12 files changed, 33 insertions, 33 deletions
diff --git a/search/applied.hh b/search/applied.hh index 88961775f..9464080cc 100644 --- a/search/applied.hh +++ b/search/applied.hh @@ -9,12 +9,12 @@ namespace search { -// A full hypothesis: a score, arity of the rule, a pointer to the decoder's rule (Note), and pointers to non-terminals that were substituted. +// A full hypothesis: a score, arity of the rule, a pointer to the decoder's rule (Note), and pointers to non-terminals that were substituted. template <class Below> class GenericApplied : public Header { public: GenericApplied() {} - GenericApplied(void *location, PartialEdge partial) + GenericApplied(void *location, PartialEdge partial) : Header(location) { memcpy(Base(), partial.Base(), kHeaderSize); Below *child_out = Children(); @@ -23,7 +23,7 @@ template <class Below> class GenericApplied : public Header { for (; part != part_end_loop; ++part, ++child_out) *child_out = Below(part->End()); } - + GenericApplied(void *location, Score score, Arity arity, Note note, Moses::WordsRange range) : Header(location, arity) { SetScore(score); SetNote(note); @@ -46,7 +46,7 @@ template <class Below> class GenericApplied : public Header { } }; -// Applied rule that references itself. +// Applied rule that references itself. class Applied : public GenericApplied<Applied> { private: typedef GenericApplied<Applied> P; @@ -57,7 +57,7 @@ class Applied : public GenericApplied<Applied> { Applied(History from) : P(from) {} }; -// How to build single-best hypotheses. +// How to build single-best hypotheses. class SingleBest { public: typedef PartialEdge Combine; @@ -68,7 +68,7 @@ class SingleBest { } NBestComplete Complete(PartialEdge partial) { - if (!partial.Valid()) + if (!partial.Valid()) return NBestComplete(NULL, lm::ngram::ChartState(), -INFINITY); void *place_final = pool_.Allocate(Applied::Size(partial.GetArity())); Applied(place_final, partial); diff --git a/search/config.hh b/search/config.hh index ba18c09e9..dd52303cb 100644 --- a/search/config.hh +++ b/search/config.hh @@ -10,7 +10,7 @@ struct NBestConfig { keep = in_size; size = in_size; } - + unsigned int keep, size; }; diff --git a/search/edge.hh b/search/edge.hh index 187904bf9..cee96b474 100644 --- a/search/edge.hh +++ b/search/edge.hh @@ -16,13 +16,13 @@ namespace search { // Copyable, but the copy will be shallow. class PartialEdge : public Header { public: - // Allow default construction for STL. + // Allow default construction for STL. PartialEdge() {} - PartialEdge(util::Pool &pool, Arity arity) + PartialEdge(util::Pool &pool, Arity arity) : Header(pool.Allocate(Size(arity, arity + 1)), arity) {} - - PartialEdge(util::Pool &pool, Arity arity, Arity chart_states) + + PartialEdge(util::Pool &pool, Arity arity, Arity chart_states) : Header(pool.Allocate(Size(arity, chart_states)), arity) {} // Non-terminals diff --git a/search/edge_generator.cc b/search/edge_generator.cc index 1f933453d..5a6431807 100644 --- a/search/edge_generator.cc +++ b/search/edge_generator.cc @@ -34,7 +34,7 @@ template <class Model> void FastScore(const Context<Model> &context, Arity victi adjustment += lm::ngram::Subsume(context.LanguageModel(), before->left, before->right, after->left, after->right, update_reveal.left.length); } before->right = after->right; - // Shift the others shifted one down, covering after. + // Shift the others shifted one down, covering after. for (lm::ngram::ChartState *cover = after; cover < between + incomplete; ++cover) { *cover = *(cover + 1); } @@ -55,7 +55,7 @@ template <class Model> PartialEdge EdgeGenerator::Pop(Context<Model> &context) { Arity victim_completed; Arity incomplete; unsigned char lowest_niceness = 255; - // Select victim or return if complete. + // Select victim or return if complete. { Arity completed = 0; for (Arity i = 0; i != arity; ++i) { @@ -89,20 +89,20 @@ template <class Model> PartialEdge EdgeGenerator::Pop(Context<Model> &context) { memcpy(alternate.Between(), top.Between(), sizeof(lm::ngram::ChartState) * (incomplete + 1)); - // TODO: dedupe? + // TODO: dedupe? generate_.push(alternate); } -#ifndef NDEBUG +#ifndef NDEBUG Score before = top.GetScore(); #endif // top is now the continuation. FastScore(context, victim, victim - victim_completed, incomplete, old_value, top); - // TODO: dedupe? + // TODO: dedupe? generate_.push(top); assert(lowest_niceness != 254 || top.GetScore() == before); - // Invalid indicates no new hypothesis generated. + // Invalid indicates no new hypothesis generated. return PartialEdge(); } diff --git a/search/header.hh b/search/header.hh index d70524097..699d8ef15 100644 --- a/search/header.hh +++ b/search/header.hh @@ -10,7 +10,7 @@ namespace search { -// Copying is shallow. +// Copying is shallow. class Header { public: bool Valid() const { return base_; } diff --git a/search/nbest.cc b/search/nbest.cc index 43ed702cb..7cf84dbb4 100644 --- a/search/nbest.cc +++ b/search/nbest.cc @@ -40,7 +40,7 @@ const std::vector<Applied> &NBestList::Extract(util::Pool &pool, std::size_t n) Score NBestList::Visit(util::Pool &pool, std::size_t index) { if (index + 1 < revealed_.size()) return revealed_[index + 1].GetScore() - revealed_[index].GetScore(); - if (queue_.empty()) + if (queue_.empty()) return -INFINITY; if (index + 1 == revealed_.size()) return queue_.top().GetScore() - revealed_[index].GetScore(); @@ -81,7 +81,7 @@ void NBestList::MoveTop(util::Pool &pool) { if (child->index_) break; } - // Convert QueueEntry to Applied. This leaves some unused memory. + // Convert QueueEntry to Applied. This leaves some unused memory. void *overwrite = entry.Children(); for (unsigned int i = 0; i < entry.GetArity(); ++i) { RevealedRef from(*(static_cast<const RevealedRef*>(overwrite) + i)); diff --git a/search/nbest.hh b/search/nbest.hh index 0aa1dfd57..17b08da38 100644 --- a/search/nbest.hh +++ b/search/nbest.hh @@ -19,8 +19,8 @@ class NBestList; class NBestList { private: class RevealedRef { - public: - explicit RevealedRef(History history) + public: + explicit RevealedRef(History history) : in_(static_cast<NBestList*>(history)), index_(0) {} private: @@ -29,7 +29,7 @@ class NBestList { NBestList *in_; std::size_t index_; }; - + typedef GenericApplied<RevealedRef> QueueEntry; public: diff --git a/search/rule.hh b/search/rule.hh index 43ca61625..dc45f6634 100644 --- a/search/rule.hh +++ b/search/rule.hh @@ -16,8 +16,8 @@ struct ScoreRuleRet { unsigned int oov; }; -// Pass <s> and </s> normally. -// Indicate non-terminals with kNonTerminal. +// Pass <s> and </s> normally. +// Indicate non-terminals with kNonTerminal. template <class Model> ScoreRuleRet ScoreRule(const Model &model, const std::vector<lm::WordIndex> &words, lm::ngram::ChartState *state_out); } // namespace search diff --git a/search/types.hh b/search/types.hh index 832ef159f..e1239dfd0 100644 --- a/search/types.hh +++ b/search/types.hh @@ -18,7 +18,7 @@ union Note { typedef void *History; struct NBestComplete { - NBestComplete(History in_history, const lm::ngram::ChartState &in_state, Score in_score) + NBestComplete(History in_history, const lm::ngram::ChartState &in_state, Score in_score) : history(in_history), state(&in_state), score(in_score) {} History history; diff --git a/search/vertex.cc b/search/vertex.cc index 305ea0c99..cb1df7e51 100644 --- a/search/vertex.cc +++ b/search/vertex.cc @@ -20,7 +20,7 @@ class DivideLeft { : index_(index) {} uint64_t operator()(const lm::ngram::ChartState &state) const { - return (index_ < state.left.length) ? + return (index_ < state.left.length) ? state.left.pointers[index_] : (kCompleteAdd - state.left.full); } @@ -71,7 +71,7 @@ uint64_t Identify(const lm::ngram::Left &left, unsigned char index) { template <class Side> class DetermineSame { public: - DetermineSame(const Side &side, unsigned char guaranteed) + DetermineSame(const Side &side, unsigned char guaranteed) : side_(side), guaranteed_(guaranteed), shared_(side.length), complete_(true) {} void Consider(const Side &other) { diff --git a/search/vertex.hh b/search/vertex.hh index f560dc8c6..e04325dc3 100644 --- a/search/vertex.hh +++ b/search/vertex.hh @@ -54,7 +54,7 @@ class VertexNode { void BuildExtend(); - // Should only happen to a root node when the entire vertex is empty. + // Should only happen to a root node when the entire vertex is empty. bool Empty() const { return hypos_.empty() && extend_.empty(); } @@ -74,7 +74,7 @@ class VertexNode { return bound_; } - // Will be invalid unless this is a leaf. + // Will be invalid unless this is a leaf. const History End() const { assert(hypos_.size() == 1); return hypos_.front().history; diff --git a/search/vertex_generator.hh b/search/vertex_generator.hh index 328da7933..6013cdb7d 100644 --- a/search/vertex_generator.hh +++ b/search/vertex_generator.hh @@ -15,7 +15,7 @@ namespace search { class ContextBase; -// Output makes the single-best or n-best list. +// Output makes the single-best or n-best list. template <class Output> class VertexGenerator { public: VertexGenerator(ContextBase &context, Vertex &gen, Output &nbest) : context_(context), gen_(gen), nbest_(nbest) {} @@ -49,7 +49,7 @@ template <class Output> class VertexGenerator { // Special case for root vertex: everything should come together into the root // node. In theory, this should happen naturally due to state collapsing with // <s> and </s>. If that's the case, VertexGenerator is fine, though it will -// make one connection. +// make one connection. template <class Output> class RootVertexGenerator { public: RootVertexGenerator(Vertex &gen, Output &out) : gen_(gen), out_(out) {} @@ -66,7 +66,7 @@ template <class Output> class RootVertexGenerator { private: Vertex &gen_; - + typename Output::Combine combine_; Output &out_; }; |