diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-12 20:35:59 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-12 20:35:59 +0300 |
commit | 20959b866045163ed3178f71b2d87a62462ec343 (patch) | |
tree | 20e3a4b7a436cb8c2557df8f98c4e8075b56e7f7 /moses/Hypothesis.cpp | |
parent | 1d0f7fcf14450c1f6152e2aa144eecbc1332c634 (diff) |
redo state API for simple distortion and KenLM. Regression failure with KenLM
Diffstat (limited to 'moses/Hypothesis.cpp')
-rw-r--r-- | moses/Hypothesis.cpp | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/moses/Hypothesis.cpp b/moses/Hypothesis.cpp index e3455a1a7..41da95756 100644 --- a/moses/Hypothesis.cpp +++ b/moses/Hypothesis.cpp @@ -195,35 +195,6 @@ Create(Manager& manager, InputType const& m_source, #endif } -/** check, if two hypothesis can be recombined. - this is actually a sorting function that allows us to - keep an ordered list of hypotheses. This makes recombination - much quicker. -*/ -int -Hypothesis:: -RecombineCompare(const Hypothesis &compare) const -{ - // -1 = this < compare - // +1 = this > compare - // 0 = this ==compare - int comp = m_sourceCompleted.Compare(compare.m_sourceCompleted); - if (comp != 0) - return comp; - - for (unsigned i = 0; i < m_ffStates.size(); ++i) { - if (m_ffStates[i] == NULL || compare.m_ffStates[i] == NULL) { - // TODO: Can this situation actually occur? - comp = int(m_ffStates[i] != NULL) - int(compare.m_ffStates[i] != NULL); - } else { - comp = m_ffStates[i]->Compare(*compare.m_ffStates[i]); - } - if (comp != 0) return comp; - } - - return 0; -} - void Hypothesis:: EvaluateWhenApplied(StatefulFeatureFunction const& sfff, @@ -650,9 +621,10 @@ GetPlaceholders(const Hypothesis &hypo, FactorType placeholderFactor) const size_t Hypothesis::hash() const { size_t seed = 0; - BOOST_FOREACH(const FFState *state, m_ffStates) { + for (size_t i = 0; i < m_ffStates.size(); ++i) { + const FFState *state = m_ffStates[i]; size_t hash = state->hash(); - boost::hash_combine(seed ,hash); + boost::hash_combine(seed, hash); } return seed; } |