mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-04 09:56:33 +03:00
Merge branch 'master' of github.com:moses-smt/mosesdecoder
This commit is contained in:
commit
c5c08993de
@ -632,6 +632,23 @@ OutputWordAlignment(vector<xmlrpc_c::value>& out) const
|
|||||||
tmp[i]->OutputLocalWordAlignment(out);
|
tmp[i]->OutputLocalWordAlignment(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Hypothesis::
|
||||||
|
beats(Hypothesis const& b) const
|
||||||
|
{
|
||||||
|
if (m_totalScore != b.m_totalScore)
|
||||||
|
return m_totalScore > b.m_totalScore;
|
||||||
|
else if (m_futureScore != b.m_futureScore)
|
||||||
|
return m_futureScore > b.m_futureScore;
|
||||||
|
else if (m_prevHypo)
|
||||||
|
return b.m_prevHypo ? m_prevHypo->beats(*b.m_prevHypo) : true;
|
||||||
|
else return false;
|
||||||
|
// TO DO: add more tie breaking here
|
||||||
|
// results. We should compare other property of the hypos here.
|
||||||
|
// On the other hand, how likely is this going to happen?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
// $Id$
|
// -*- mode: c++; indent-tabs-mode: nil; tab-width:2 -*-
|
||||||
// vim:tabstop=2
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Moses - factored phrase-based language decoder
|
Moses - factored phrase-based language decoder
|
||||||
Copyright (C) 2006 University of Edinburgh
|
Copyright (C) 2006 University of Edinburgh
|
||||||
@ -69,7 +67,6 @@ typedef std::vector<Hypothesis*> ArcList;
|
|||||||
class Hypothesis
|
class Hypothesis
|
||||||
{
|
{
|
||||||
friend std::ostream& operator<<(std::ostream&, const Hypothesis&);
|
friend std::ostream& operator<<(std::ostream&, const Hypothesis&);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const Hypothesis* m_prevHypo; /*! backpointer to previous hypothesis (from which this one was created) */
|
const Hypothesis* m_prevHypo; /*! backpointer to previous hypothesis (from which this one was created) */
|
||||||
const Bitmap &m_sourceCompleted; /*! keeps track of which words have been translated so far */
|
const Bitmap &m_sourceCompleted; /*! keeps track of which words have been translated so far */
|
||||||
@ -283,6 +280,8 @@ public:
|
|||||||
void OutputLocalWordAlignment(std::vector<xmlrpc_c::value>& dest) const;
|
void OutputLocalWordAlignment(std::vector<xmlrpc_c::value>& dest) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool beats(Hypothesis const& b) const;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -290,8 +289,8 @@ std::ostream& operator<<(std::ostream& out, const Hypothesis& hypothesis);
|
|||||||
|
|
||||||
// sorting helper
|
// sorting helper
|
||||||
struct CompareHypothesisTotalScore {
|
struct CompareHypothesisTotalScore {
|
||||||
bool operator()(const Hypothesis* hypo1, const Hypothesis* hypo2) const {
|
bool operator()(const Hypothesis* a, const Hypothesis* b) const {
|
||||||
return hypo1->GetTotalScore() > hypo2->GetTotalScore();
|
return a->beats(*b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user