mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-11-12 16:27:56 +03:00
debug
This commit is contained in:
parent
392abaf2e8
commit
8dc7d5612f
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user