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/Word.cpp | |
parent | 0c3fea4014efc8499b0d43fb93d124d27dc9449a (diff) |
clean up states after API change
Diffstat (limited to 'moses/Word.cpp')
-rw-r--r-- | moses/Word.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/moses/Word.cpp b/moses/Word.cpp index f55be5ee8..7dfedee4f 100644 --- a/moses/Word.cpp +++ b/moses/Word.cpp @@ -63,7 +63,22 @@ int Word::Compare(const Word &targetWord, const Word &sourceWord) return (targetFactor<sourceFactor) ? -1 : +1; } return 0; +} + +bool Word::operator==(const Word &compare) const { + if (IsNonTerminal() != compare.IsNonTerminal()) { + return false; + } + for (size_t factorType = 0 ; factorType < MAX_NUM_FACTORS ; factorType++) { + const Factor *thisFactor = GetFactor(factorType); + const Factor *otherFactor = compare.GetFactor(factorType); + + if (thisFactor != otherFactor) { + return false; + } + } + return true; } void Word::Merge(const Word &sourceWord) |