diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-17 22:14:24 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-17 22:14:24 +0300 |
commit | 563552aea6c6de060ef36788609867ef6bd851fb (patch) | |
tree | 9902233443b38d36a8e930efc355a5e58a7f46bc /moses/Phrase.cpp | |
parent | 0c3fea4014efc8499b0d43fb93d124d27dc9449a (diff) |
clean up states after API change
Diffstat (limited to 'moses/Phrase.cpp')
-rw-r--r-- | moses/Phrase.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/moses/Phrase.cpp b/moses/Phrase.cpp index 7a9e847ba..d689b2ddb 100644 --- a/moses/Phrase.cpp +++ b/moses/Phrase.cpp @@ -253,6 +253,25 @@ int Phrase::Compare(const Phrase &other) const return 0; } +bool Phrase::operator== (const Phrase &other) const { + size_t thisSize = GetSize() + ,compareSize = other.GetSize(); + if (thisSize != compareSize) { + return false; + } + + for (size_t pos = 0 ; pos < thisSize ; pos++) { + const Word &thisWord = GetWord(pos) + ,&otherWord = other.GetWord(pos); + bool ret = thisWord == otherWord; + if (!ret) { + return false; + } + } + + return true; +} + bool Phrase::Contains(const vector< vector<string> > &subPhraseVector , const vector<FactorType> &inputFactor) const |