2010-07-18 03:23:09 +04:00
|
|
|
// $Id$
|
2010-04-08 21:16:10 +04:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <algorithm>
|
2012-11-13 00:21:32 +04:00
|
|
|
|
2010-04-08 21:16:10 +04:00
|
|
|
#include "TranslationAnalysis.h"
|
2012-11-13 00:21:32 +04:00
|
|
|
|
|
|
|
#include "moses/StaticData.h"
|
|
|
|
#include "moses/TranslationOption.h"
|
|
|
|
#include "moses/DecodeStepTranslation.h"
|
2010-04-08 21:16:10 +04:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Moses;
|
|
|
|
|
2011-02-24 15:40:21 +03:00
|
|
|
namespace TranslationAnalysis
|
|
|
|
{
|
2010-04-08 21:16:10 +04:00
|
|
|
|
2011-02-24 19:17:38 +03:00
|
|
|
void PrintTranslationAnalysis(ostream & /* os */, const Hypothesis* /* hypo */)
|
2010-04-08 21:16:10 +04:00
|
|
|
{
|
2011-02-24 15:40:21 +03:00
|
|
|
/*
|
|
|
|
os << endl << "TRANSLATION HYPOTHESIS DETAILS:" << endl;
|
2010-04-08 21:16:10 +04:00
|
|
|
queue<const Hypothesis*> translationPath;
|
2011-02-24 15:40:21 +03:00
|
|
|
while (hypo)
|
|
|
|
{
|
|
|
|
translationPath.push(hypo);
|
2010-04-08 21:16:10 +04:00
|
|
|
hypo = hypo->GetPrevHypo();
|
|
|
|
}
|
|
|
|
|
2011-02-24 15:40:21 +03:00
|
|
|
while (!translationPath.empty())
|
|
|
|
{
|
|
|
|
hypo = translationPath.front();
|
|
|
|
translationPath.pop();
|
|
|
|
const TranslationOption *transOpt = hypo->GetTranslationOption();
|
|
|
|
if (transOpt != NULL)
|
|
|
|
{
|
|
|
|
os << hypo->GetCurrSourceWordsRange() << " ";
|
|
|
|
for (size_t decodeStepId = 0; decodeStepId < DecodeStepTranslation::GetNumTransStep(); ++decodeStepId)
|
|
|
|
os << decodeStepId << "=" << transOpt->GetSubRangeCount(decodeStepId) << ",";
|
|
|
|
os << *transOpt << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
os << "END TRANSLATION" << endl;
|
|
|
|
*/
|
2010-04-08 21:16:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|