This commit is contained in:
Hieu Hoang 2016-08-23 22:38:27 +01:00
parent 392abaf2e8
commit 8dc7d5612f
4 changed files with 16 additions and 0 deletions

View File

@ -5,6 +5,7 @@
* Author: hieu
*/
#include <iostream>
#include <sstream>
#include <algorithm>
#include <boost/foreach.hpp>
#include "ArcLists.h"
@ -114,5 +115,15 @@ void ArcLists::Delete(const HypothesisBase *hypo)
delete arcList;
}
std::string ArcLists::Debug(const System &system) const
{
stringstream strm;
BOOST_FOREACH(const Coll::value_type &collPair, m_coll){
const ArcList *arcList = collPair.second;
strm << arcList << "(" << arcList->size() << ") ";
}
return strm.str();
}
}

View File

@ -10,6 +10,7 @@
namespace Moses2
{
class System;
class HypothesisBase;
@ -28,6 +29,7 @@ public:
const ArcList &GetArcList(const HypothesisBase *hypo) const;
std::string Debug(const System &system) const;
protected:
typedef boost::unordered_map<const HypothesisBase*, ArcList*> Coll;
Coll m_coll;

View File

@ -288,6 +288,8 @@ KBestExtractor::KBestExtractor(const SCFG::Manager &mgr)
break;
}
cerr << "RANGE=" << startPos << " " << phraseSize << endl;
const Stack &stack = stacks.GetStack(startPos, phraseSize);
const Stack::Coll &allHypoColl = stack.GetColl();
BOOST_FOREACH(const Stack::Coll::value_type &valPair, allHypoColl) {

View File

@ -387,6 +387,7 @@ std::string Manager::OutputNBest()
//Moses2::FixPrecision(out);
arcLists.Sort();
//cerr << "arcs=" << arcLists.Debug(system) << endl;
KBestExtractor extractor(*this);
extractor.OutputToStream(out);