diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-13 15:17:34 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-13 15:17:34 +0300 |
commit | 4ea806a159d92e86fd6b3670ca59da3ec69e8713 (patch) | |
tree | 8a4f945561b0652974d3a5bc25d8c97816743bcd /moses/FF | |
parent | 10c2dabe3d165c1a657e5b226fa1e8d57be5d079 (diff) |
new FF state API for HReorderingForwardState
Diffstat (limited to 'moses/FF')
-rw-r--r-- | moses/FF/LexicalReordering/LexicalReorderingState.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/moses/FF/LexicalReordering/LexicalReorderingState.cpp b/moses/FF/LexicalReordering/LexicalReorderingState.cpp index 6f368b9a9..6e6ecaf46 100644 --- a/moses/FF/LexicalReordering/LexicalReorderingState.cpp +++ b/moses/FF/LexicalReordering/LexicalReorderingState.cpp @@ -512,12 +512,22 @@ Compare(const FFState& o) const size_t HReorderingForwardState::hash() const { - UTIL_THROW2("TODO:Haven't figure this out yet"); + size_t ret; + ret = hash_value(m_prevRange); + return ret; } -bool HReorderingForwardState::operator==(const FFState& other) const +bool HReorderingForwardState::operator==(const FFState& o) const { - UTIL_THROW2("TODO:Haven't figure this out yet"); + if (&o == this) return true; + + HReorderingForwardState const& other + = static_cast<HReorderingForwardState const&>(o); + + int compareScores = ((m_prevRange == other.m_prevRange) + ? ComparePrevScores(other.m_prevOption) + : (m_prevRange < other.m_prevRange) ? -1 : 1); + return compareScores == 0; } // For compatibility with the phrase-based reordering model, scoring is one |