diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-11-04 20:32:12 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-11-04 20:32:12 +0300 |
commit | c435e46560c96f7e07f6090016331b2416641c73 (patch) | |
tree | 9c0d74d7dc7cf6ff7f31088ec163b0db8cea3bd9 /moses/Hypothesis.cpp | |
parent | 3ad35a72ecd64ee0d9121a3f060b67dc45fe6ab3 (diff) |
Moved implementation of server-specific member functions of Hypothesis class into a separate file.
Diffstat (limited to 'moses/Hypothesis.cpp')
-rw-r--r-- | moses/Hypothesis.cpp | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/moses/Hypothesis.cpp b/moses/Hypothesis.cpp index c26889275..c9b0123af 100644 --- a/moses/Hypothesis.cpp +++ b/moses/Hypothesis.cpp @@ -1,4 +1,4 @@ -// $Id$ +// -*- mode: c++; indent-tabs-mode: nil; tab-width:2 -*- // vim:tabstop=2 /*********************************************************************** Moses - factored phrase-based language decoder @@ -566,11 +566,14 @@ size_t Hypothesis::hash() const { size_t seed; - // coverage - // NOTE from Hieu - we could make bitmap comparison here and in operator== compare the pointers since the bitmaps come from a factory. - // Same coverage is guaranteed to have the same bitmap. However, this make the decoding algorithm non-deterministic as the order - // of hypo extension can be different. This causes several regression tests to break. Since the speedup is minimal, I'm gonna leave - // it comparing the actual bitmaps + // coverage NOTE from Hieu - we could make bitmap comparison here + // and in operator== compare the pointers since the bitmaps come + // from a factory. Same coverage is guaranteed to have the same + // bitmap. However, this make the decoding algorithm + // non-deterministic as the order of hypo extension can be + // different. This causes several regression tests to break. Since + // the speedup is minimal, I'm gonna leave it comparing the actual + // bitmaps seed = m_sourceCompleted.hash(); // states @@ -616,40 +619,5 @@ beats(Hypothesis const& b) const // On the other hand, how likely is this going to happen? } -#ifdef HAVE_XMLRPC_C -void -Hypothesis:: -OutputLocalWordAlignment(vector<xmlrpc_c::value>& dest) const -{ - using namespace std; - Range const& src = this->GetCurrSourceWordsRange(); - Range const& trg = this->GetCurrTargetWordsRange(); - - WordAlignmentSort waso = m_manager.options().output.WA_SortOrder; - vector<pair<size_t,size_t> const* > a - = this->GetCurrTargetPhrase().GetAlignTerm().GetSortedAlignments(waso); - typedef pair<size_t,size_t> item; - map<string, xmlrpc_c::value> M; - BOOST_FOREACH(item const* p, a) { - M["source-word"] = xmlrpc_c::value_int(src.GetStartPos() + p->first); - M["target-word"] = xmlrpc_c::value_int(trg.GetStartPos() + p->second); - dest.push_back(xmlrpc_c::value_struct(M)); - } -} - -void -Hypothesis:: -OutputWordAlignment(vector<xmlrpc_c::value>& out) const -{ - vector<Hypothesis const*> tmp; - for (Hypothesis const* h = this; h; h = h->GetPrevHypo()) - tmp.push_back(h); - for (size_t i = tmp.size(); i-- > 0;) - tmp[i]->OutputLocalWordAlignment(out); -} - -#endif - - } |