Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/moses/FF
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-10-13 15:17:34 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-10-13 15:17:34 +0300
commit4ea806a159d92e86fd6b3670ca59da3ec69e8713 (patch)
tree8a4f945561b0652974d3a5bc25d8c97816743bcd /moses/FF
parent10c2dabe3d165c1a657e5b226fa1e8d57be5d079 (diff)
new FF state API for HReorderingForwardState
Diffstat (limited to 'moses/FF')
-rw-r--r--moses/FF/LexicalReordering/LexicalReorderingState.cpp16
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