mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-30 23:42:30 +03:00
Change CompareFutureScore()
This commit is contained in:
parent
14bfbdc5e3
commit
8f4764f1bc
@ -54,7 +54,7 @@ void TargetPhrases::SortAndPrune(size_t tableLimit)
|
||||
m_coll.end() : m_coll.begin() + tableLimit;
|
||||
|
||||
std::partial_sort(m_coll.begin(), iterMiddle, m_coll.end(),
|
||||
CompareFutureScore<Word>());
|
||||
CompareFutureScore<TP>());
|
||||
|
||||
if (tableLimit && m_coll.size() > tableLimit) {
|
||||
m_coll.resize(tableLimit);
|
||||
|
@ -19,7 +19,8 @@ class System;
|
||||
|
||||
class TargetPhrases
|
||||
{
|
||||
typedef Array<const TargetPhrase<Moses2::Word>*> Coll;
|
||||
typedef TargetPhrase<Moses2::Word> TP;
|
||||
typedef Array<const TP*> Coll;
|
||||
public:
|
||||
typedef Coll::iterator iterator;
|
||||
typedef Coll::const_iterator const_iterator;
|
||||
@ -37,7 +38,7 @@ public:
|
||||
//TargetPhrases(MemPool &pool, const System &system, const TargetPhrases ©);
|
||||
virtual ~TargetPhrases();
|
||||
|
||||
void AddTargetPhrase(const TargetPhrase<Moses2::Word> &targetPhrase)
|
||||
void AddTargetPhrase(const TP &targetPhrase)
|
||||
{
|
||||
m_coll[m_currInd++] = &targetPhrase;
|
||||
}
|
||||
@ -47,7 +48,7 @@ public:
|
||||
return m_coll.size();
|
||||
}
|
||||
|
||||
const TargetPhrase<Moses2::Word>& operator[](size_t ind) const
|
||||
const TP& operator[](size_t ind) const
|
||||
{
|
||||
return *m_coll[ind];
|
||||
}
|
||||
|
@ -58,15 +58,15 @@ protected:
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
template<typename WORD>
|
||||
template<typename TP>
|
||||
struct CompareFutureScore
|
||||
{
|
||||
bool operator()(const TargetPhrase<WORD> *a, const TargetPhrase<WORD> *b) const
|
||||
bool operator()(const TP *a, const TP *b) const
|
||||
{
|
||||
return a->GetFutureScore() > b->GetFutureScore();
|
||||
}
|
||||
|
||||
bool operator()(const TargetPhrase<WORD> &a, const TargetPhrase<WORD> &b) const
|
||||
bool operator()(const TP &a, const TP &b) const
|
||||
{
|
||||
return a.GetFutureScore() > b.GetFutureScore();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user