create deviants

This commit is contained in:
Hieu Hoang 2016-08-23 16:57:25 +01:00
parent 5d33d7f6e8
commit 3af84b6fc9
2 changed files with 22 additions and 7 deletions

View File

@ -56,6 +56,11 @@ const SCFG::Hypothesis &NBest::GetHypo() const
return hypo;
}
void NBest::CreateDeviants(std::priority_queue<NBest*> &contenders)
{
}
void NBest::OutputToStream(
const SCFG::Manager &mgr,
std::stringstream &strm,
@ -110,19 +115,26 @@ void NBestColl::Add(const SCFG::Manager &mgr, const ArcList &arcList)
{
NBests &nbests = GetOrCreateNBests(arcList);
//priority_queue<NBest*> contenders;
priority_queue<NBest*> contenders;
NBest *best = new NBest(mgr, *this, arcList, 0);
nbests.push_back(best);
NBest *contender;
// best
contender = new NBest(mgr, *this, arcList, 0);
contenders.push(contender);
size_t maxIter = mgr.system.options.nbest.nbest_size * mgr.system.options.nbest.factor;
size_t bestInd = 0;
for (size_t i = 0; i < maxIter; ++i) {
/*
if (bestInd > mgr.system.options.nbest.nbest_size || contenders.empty()) {
if (nbests.size() >= mgr.system.options.nbest.nbest_size || contenders.empty()) {
break;
}
*/
NBest *best = contenders.top();
contenders.pop();
nbests.push_back(best);
best->CreateDeviants(contenders);
}
}

View File

@ -7,6 +7,7 @@
#pragma once
#include <vector>
#include <sstream>
#include <queue>
#include <boost/unordered_map.hpp>
#include "../ArcLists.h"
#include "TargetPhraseImpl.h"
@ -38,6 +39,8 @@ public:
const ArcList &varcList,
size_t vind);
void CreateDeviants(std::priority_queue<NBest*> &contenders);
const Scores &GetScores() const
{ return *m_scores; }