init m_hypoIndColl

This commit is contained in:
Hieu Hoang 2016-08-17 14:10:32 +01:00
parent 5054aa053f
commit c6c10ec551
3 changed files with 13 additions and 9 deletions

View File

@ -237,7 +237,7 @@ void Manager::CreateQueue(
assert(unseen); assert(unseen);
QueueItem *item = QueueItem::Create(GetPool(), *this); QueueItem *item = QueueItem::Create(GetPool(), *this);
item->Init(GetPool(), symbolBind, tps); item->Init(GetPool(), symbolBind, tps, seenItem->hypoIndColl);
for (size_t i = 0; i < symbolBind.coll.size(); ++i) { for (size_t i = 0; i < symbolBind.coll.size(); ++i) {
const SymbolBindElement &ele = symbolBind.coll[i]; const SymbolBindElement &ele = symbolBind.coll[i];
if (ele.hypos) { if (ele.hypos) {

View File

@ -125,24 +125,28 @@ QueueItem::QueueItem(MemPool &pool)
void QueueItem::Init( void QueueItem::Init(
MemPool &pool, MemPool &pool,
const SymbolBind &vSymbolBind, const SymbolBind &vSymbolBind,
const SCFG::TargetPhrases &vTPS) const SCFG::TargetPhrases &vTPS,
const Vector<size_t> &hypoIndColl)
{ {
symbolBind = &vSymbolBind; symbolBind = &vSymbolBind;
tps = &vTPS; tps = &vTPS;
tpInd = 0; tpInd = 0;
m_hyposColl = new (pool.Allocate<HyposColl>()) HyposColl(pool); m_hyposColl = new (pool.Allocate<HyposColl>()) HyposColl(pool);
m_hypoIndColl = &hypoIndColl;
} }
void QueueItem::Init( void QueueItem::Init(
MemPool &pool, MemPool &pool,
const SymbolBind &vSymbolBind, const SymbolBind &vSymbolBind,
const SCFG::TargetPhrases &vTPS, const SCFG::TargetPhrases &vTPS,
size_t vTPInd) size_t vTPInd,
const Vector<size_t> &hypoIndColl)
{ {
symbolBind = &vSymbolBind; symbolBind = &vSymbolBind;
tps = &vTPS; tps = &vTPS;
tpInd = vTPInd; tpInd = vTPInd;
m_hyposColl = NULL; m_hyposColl = NULL;
m_hypoIndColl = &hypoIndColl;
} }
void QueueItem::AddHypos(const Moses2::Hypotheses &hypos) void QueueItem::AddHypos(const Moses2::Hypotheses &hypos)
@ -180,9 +184,8 @@ void QueueItem::CreateNext(
if (unseen) { if (unseen) {
QueueItem *item = QueueItem::Create(mgrPool, mgr); QueueItem *item = QueueItem::Create(mgrPool, mgr);
item->Init(mgrPool, *symbolBind, *tps, tpInd + 1); item->Init(mgrPool, *symbolBind, *tps, tpInd + 1, *m_hypoIndColl);
item->m_hyposColl = m_hyposColl; item->m_hyposColl = m_hyposColl;
item->m_hypoIndColl = m_hypoIndColl;
item->CreateHypo(systemPool, mgr, path, *symbolBind); item->CreateHypo(systemPool, mgr, path, *symbolBind);
queue.push(item); queue.push(item);
@ -202,10 +205,9 @@ void QueueItem::CreateNext(
if (unseen) { if (unseen) {
QueueItem *item = QueueItem::Create(mgrPool, mgr); QueueItem *item = QueueItem::Create(mgrPool, mgr);
item->Init(mgrPool, *symbolBind, *tps, tpInd); item->Init(mgrPool, *symbolBind, *tps, tpInd, seenItem->hypoIndColl);
item->m_hyposColl = m_hyposColl; item->m_hyposColl = m_hyposColl;
item->m_hypoIndColl = &seenItem->hypoIndColl;
item->CreateHypo(systemPool, mgr, path, *symbolBind); item->CreateHypo(systemPool, mgr, path, *symbolBind);
queue.push(item); queue.push(item);

View File

@ -76,12 +76,14 @@ public:
void Init( void Init(
MemPool &pool, MemPool &pool,
const SymbolBind &symbolBind, const SymbolBind &symbolBind,
const SCFG::TargetPhrases &tps); const SCFG::TargetPhrases &tps,
const Vector<size_t> &hypoIndColl);
void Init( void Init(
MemPool &pool, MemPool &pool,
const SymbolBind &symbolBind, const SymbolBind &symbolBind,
const SCFG::TargetPhrases &tps, const SCFG::TargetPhrases &tps,
size_t vTPInd); size_t vTPInd,
const Vector<size_t> &hypoIndColl);
void AddHypos(const Moses2::Hypotheses &hypos); void AddHypos(const Moses2::Hypotheses &hypos);
void CreateHypo( void CreateHypo(
MemPool &systemPool, MemPool &systemPool,