mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-26 11:28:48 +03:00
more debug functions
This commit is contained in:
parent
fb356606e9
commit
bc9ce334d0
@ -36,6 +36,7 @@ using namespace std;
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
extern bool g_mosesDebug;
|
||||
|
||||
ChartCellBase::ChartCellBase(size_t startPos, size_t endPos) :
|
||||
m_coverage(startPos, endPos),
|
||||
@ -94,6 +95,10 @@ void ChartCell::ProcessSentence(const ChartTranslationOptionList &transOptList
|
||||
for (size_t i = 0; i < transOptList.GetSize(); ++i) {
|
||||
const ChartTranslationOptions &transOpt = transOptList.Get(i);
|
||||
RuleCube *ruleCube = new RuleCube(transOpt, allChartCells, m_manager);
|
||||
if (g_mosesDebug) {
|
||||
cerr << *ruleCube << endl;
|
||||
}
|
||||
|
||||
queue.Add(ruleCube);
|
||||
}
|
||||
|
||||
|
@ -90,10 +90,20 @@ void ChartManager::ProcessSentence()
|
||||
const InputPath &inputPath = m_parser.GetInputPath(range);
|
||||
m_translationOptionList.Evaluate(m_source, inputPath);
|
||||
|
||||
g_mosesDebug = false;
|
||||
if (startPos == 1 && endPos == 1) {
|
||||
cerr << m_translationOptionList << endl;
|
||||
g_mosesDebug = true;
|
||||
}
|
||||
|
||||
// decode
|
||||
ChartCell &cell = m_hypoStackColl.Get(range);
|
||||
|
||||
cell.ProcessSentence(m_translationOptionList, m_hypoStackColl);
|
||||
if (g_mosesDebug) {
|
||||
cerr << cell << endl;
|
||||
}
|
||||
|
||||
m_translationOptionList.Clear();
|
||||
cell.PruneToSize();
|
||||
cell.CleanupArcList();
|
||||
|
@ -59,6 +59,9 @@ public:
|
||||
static float CalcEstimateOfBestScore(const TargetPhraseCollection &,
|
||||
const StackVec &);
|
||||
|
||||
size_t GetSize() const
|
||||
{ return m_collection.size(); }
|
||||
|
||||
//! @todo dunno
|
||||
const StackVec &GetStackVec() const {
|
||||
return m_stackVec;
|
||||
|
@ -30,8 +30,11 @@
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
extern bool g_mosesDebug;
|
||||
|
||||
// initialise the RuleCube by creating the top-left corner item
|
||||
RuleCube::RuleCube(const ChartTranslationOptions &transOpt,
|
||||
@ -39,6 +42,10 @@ RuleCube::RuleCube(const ChartTranslationOptions &transOpt,
|
||||
ChartManager &manager)
|
||||
: m_transOpt(transOpt)
|
||||
{
|
||||
if (g_mosesDebug) {
|
||||
cerr << transOpt.GetSize() << endl;
|
||||
}
|
||||
|
||||
RuleCubeItem *item = new RuleCubeItem(transOpt, allChartCells);
|
||||
m_covered.insert(item);
|
||||
if (StaticData::Instance().GetCubePruningLazyScoring()) {
|
||||
@ -98,4 +105,9 @@ void RuleCube::CreateNeighbor(const RuleCubeItem &item, int dimensionIndex,
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const RuleCube &obj)
|
||||
{
|
||||
out << obj.GetItemSetSize();
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,8 @@ public:
|
||||
*/
|
||||
class RuleCube
|
||||
{
|
||||
friend std::ostream& operator<<(std::ostream &out, const RuleCube &obj);
|
||||
|
||||
public:
|
||||
RuleCube(const ChartTranslationOptions &, const ChartCellCollection &,
|
||||
ChartManager &);
|
||||
@ -112,6 +114,9 @@ public:
|
||||
return m_transOpt;
|
||||
}
|
||||
|
||||
size_t GetItemSetSize() const
|
||||
{ return m_covered.size(); }
|
||||
|
||||
private:
|
||||
#if defined(BOOST_VERSION) && (BOOST_VERSION >= 104200)
|
||||
typedef boost::unordered_set<RuleCubeItem*,
|
||||
|
Loading…
Reference in New Issue
Block a user