From eca582410006443d0b101a9ae188e302f34f8a03 Mon Sep 17 00:00:00 2001 From: Jeroen Vermeulen Date: Thu, 30 Apr 2015 12:05:11 +0700 Subject: Remove trailing whitespace in C++ files. --- moses/TranslationModel/UG/mm/ug_phrasepair.h | 122 +++++++++++++-------------- 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'moses/TranslationModel/UG/mm/ug_phrasepair.h') diff --git a/moses/TranslationModel/UG/mm/ug_phrasepair.h b/moses/TranslationModel/UG/mm/ug_phrasepair.h index 70d4b0d82..53a9f761c 100644 --- a/moses/TranslationModel/UG/mm/ug_phrasepair.h +++ b/moses/TranslationModel/UG/mm/ug_phrasepair.h @@ -11,7 +11,7 @@ namespace Moses namespace bitext { template - class + class PhrasePair { public: @@ -36,24 +36,24 @@ namespace Moses bool operator<(PhrasePair const& other) const; bool operator>(PhrasePair const& other) const; - bool operator<=(PhrasePair const& other) const; + bool operator<=(PhrasePair const& other) const; bool operator>=(PhrasePair const& other) const; void init(); - void init(uint64_t const pid1, bool is_inverse, + void init(uint64_t const pid1, bool is_inverse, Token const* x, uint32_t const len, pstats const* ps = NULL, size_t const numfeats=0); - PhrasePair const& - update(uint64_t const pid2, Token const* x, + PhrasePair const& + update(uint64_t const pid2, Token const* x, uint32_t const len, jstats const& js); void - fill_lr_vec(LRModel::Direction const& dir, - LRModel::ModelType const& mdl, + fill_lr_vec(LRModel::Direction const& dir, + LRModel::ModelType const& mdl, vector& v) const; void - print(ostream& out, TokenIndex const& V1, TokenIndex const& V2, + print(ostream& out, TokenIndex const& V1, TokenIndex const& V2, LRModel const& LR) const; class SortByTargetIdSeq @@ -62,7 +62,7 @@ namespace Moses int cmp(PhrasePair const& a, PhrasePair const& b) const; bool operator()(PhrasePair const& a, PhrasePair const& b) const; }; - + class SortDescendingByJointCount { public: @@ -73,8 +73,8 @@ namespace Moses template void PhrasePair - ::init(uint64_t const pid1, bool is_inverse, - Token const* x, uint32_t const len, + ::init(uint64_t const pid1, bool is_inverse, + Token const* x, uint32_t const len, pstats const* ps, size_t const numfeats) { inverse = is_inverse; @@ -98,15 +98,15 @@ namespace Moses template PhrasePair const& PhrasePair - ::update(uint64_t const pid2, - Token const* x, uint32_t const len, jstats const& js) + ::update(uint64_t const pid2, + Token const* x, uint32_t const len, jstats const& js) { p2 = pid2; start2 = x; len2 = len; raw2 = js.cnt2(); joint = js.rcnt(); assert(js.aln().size()); - if (js.aln().size()) + if (js.aln().size()) aln = js.aln()[0].second; // float total_fwd = 0, total_bwd = 0; // for (int i = 0; i <= Moses::LRModel::NONE; i++) @@ -123,48 +123,48 @@ namespace Moses dfwd[i] = js.dcnt_fwd(po); dbwd[i] = js.dcnt_bwd(po); } - + indoc = js.indoc; return *this; } template - bool + bool PhrasePair - ::operator<(PhrasePair const& other) const - { - return this->score < other.score; + ::operator<(PhrasePair const& other) const + { + return this->score < other.score; } - + template - bool + bool PhrasePair ::operator>(PhrasePair const& other) const - { - return this->score > other.score; + { + return this->score > other.score; } template - bool + bool PhrasePair - ::operator<=(PhrasePair const& other) const - { - return this->score <= other.score; + ::operator<=(PhrasePair const& other) const + { + return this->score <= other.score; } - + template - bool + bool PhrasePair ::operator>=(PhrasePair const& other) const - { - return this->score >= other.score; + { + return this->score >= other.score; } template PhrasePair const& PhrasePair - ::operator+=(PhrasePair const& o) - { + ::operator+=(PhrasePair const& o) + { raw1 += o.raw1; raw2 += o.raw2; good1 += o.good1; @@ -178,16 +178,16 @@ namespace Moses template PhrasePair - ::PhrasePair(PhrasePair const& o) + ::PhrasePair(PhrasePair const& o) : start1(o.start1) , start2(o.start2) , len1(o.len1) , len2(o.len2) , p1(o.p1) , p2(o.p2) - , raw1(o.raw1) , raw2(o.raw2) + , raw1(o.raw1) , raw2(o.raw2) , sample1(o.sample1) , sample2(o.sample2) , good1(o.good1) , good2(o.good2) - , joint(o.joint) + , joint(o.joint) , fvals(o.fvals) - , aln(o.aln) + , aln(o.aln) , score(o.score) , inverse(o.inverse) , indoc(o.indoc) @@ -198,7 +198,7 @@ namespace Moses dbwd[i] = o.dbwd[i]; } } - + template int PhrasePair ::SortByTargetIdSeq @@ -207,7 +207,7 @@ namespace Moses size_t i = 0; Token const* x = a.start2; Token const* y = b.start2; - while (i < a.len2 && i < b.len2 && x->id() == y->id()) + while (i < a.len2 && i < b.len2 && x->id() == y->id()) { x = x->next(); y = y->next(); @@ -218,7 +218,7 @@ namespace Moses if (i == b.len2) return 1; return x->id() < y->id() ? -1 : 1; } - + template bool PhrasePair ::SortByTargetIdSeq @@ -237,16 +237,16 @@ namespace Moses } template - bool + bool PhrasePair ::SortDescendingByJointCount ::operator()(PhrasePair const& a, PhrasePair const& b) const { return this->cmp(a,b) < 0; } - + template - void + void PhrasePair ::init() { @@ -257,21 +257,21 @@ namespace Moses } - void - fill_lr_vec2(LRModel::ModelType mdl, float const* const cnt, + void + fill_lr_vec2(LRModel::ModelType mdl, float const* const cnt, float const total, float* v); - + template void PhrasePair - ::fill_lr_vec(LRModel::Direction const& dir, - LRModel::ModelType const& mdl, + ::fill_lr_vec(LRModel::Direction const& dir, + LRModel::ModelType const& mdl, vector& v) const { // how many distinct scores do we have? size_t num_scores = (mdl == LRModel::MSLR ? 4 : mdl == LRModel::MSD ? 3 : 2); size_t offset; - if (dir == LRModel::Bidirectional) + if (dir == LRModel::Bidirectional) { offset = num_scores; num_scores *= 2; @@ -281,32 +281,32 @@ namespace Moses v.resize(num_scores); // determine the denominator - float total = 0; - for (size_t i = 0; i <= LRModel::NONE; ++i) + float total = 0; + for (size_t i = 0; i <= LRModel::NONE; ++i) total += dfwd[i]; if (dir != LRModel::Forward) // i.e., Backward or Bidirectional fill_lr_vec2(mdl, dbwd, total, &v[0]); if (dir != LRModel::Backward) // i.e., Forward or Bidirectional fill_lr_vec2(mdl, dfwd, total, &v[offset]); - } - + } + template void PhrasePair - ::print(ostream& out, TokenIndex const& V1, TokenIndex const& V2, + ::print(ostream& out, TokenIndex const& V1, TokenIndex const& V2, LRModel const& LR) const { - out << toString (V1, this->start1, this->len1) << " ::: " - << toString (V2, this->start2, this->len2) << " " + out << toString (V1, this->start1, this->len1) << " ::: " + << toString (V2, this->start2, this->len2) << " " << this->joint << " ["; for (size_t i = 0; i < this->indoc.size(); ++i) - { - if (i) out << " "; - out << this->indoc[i]; + { + if (i) out << " "; + out << this->indoc[i]; } - out << "] ["; + out << "] ["; vector lrscores; this->fill_lr_vec(LR.GetDirection(), LR.GetModelType(), lrscores); for (size_t i = 0; i < lrscores.size(); ++i) @@ -322,7 +322,7 @@ namespace Moses if (i) *log << " "; *log << p.dfwd[i]; } - *log << "] ["; + *log << "] ["; for (int i = 0; i <= Moses::LRModel::NONE; i++) { // PhraseOrientation po = static_cast(i); -- cgit v1.2.3