mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 21:42:19 +03:00
delete OutputNBest() in IOWrapper
This commit is contained in:
parent
d0576866af
commit
08c57bce87
@ -1251,80 +1251,6 @@ bool IOWrapper::ReadInput(InputTypeEnum inputType, InputType*& source)
|
||||
return (source ? true : false);
|
||||
}
|
||||
|
||||
void IOWrapper::OutputNBest(std::ostream& out
|
||||
, const Moses::TrellisPathList &nBestList
|
||||
, const std::vector<Moses::FactorType>& outputFactorOrder
|
||||
, long translationId
|
||||
, char reportSegmentation)
|
||||
{
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
bool reportAllFactors = staticData.GetReportAllFactorsNBest();
|
||||
bool includeSegmentation = staticData.NBestIncludesSegmentation();
|
||||
bool includeWordAlignment = staticData.PrintAlignmentInfoInNbest();
|
||||
|
||||
TrellisPathList::const_iterator iter;
|
||||
for (iter = nBestList.begin() ; iter != nBestList.end() ; ++iter) {
|
||||
const TrellisPath &path = **iter;
|
||||
const std::vector<const Hypothesis *> &edges = path.GetEdges();
|
||||
|
||||
// print the surface factor of the translation
|
||||
out << translationId << " ||| ";
|
||||
for (int currEdge = (int)edges.size() - 1 ; currEdge >= 0 ; currEdge--) {
|
||||
const Hypothesis &edge = *edges[currEdge];
|
||||
OutputSurface(out, edge, outputFactorOrder, reportSegmentation, reportAllFactors);
|
||||
}
|
||||
out << " |||";
|
||||
|
||||
// print scores with feature names
|
||||
OutputAllFeatureScores(path.GetScoreBreakdown(), out );
|
||||
|
||||
// total
|
||||
out << " ||| " << path.GetTotalScore();
|
||||
|
||||
//phrase-to-phrase segmentation
|
||||
if (includeSegmentation) {
|
||||
out << " |||";
|
||||
for (int currEdge = (int)edges.size() - 2 ; currEdge >= 0 ; currEdge--) {
|
||||
const Hypothesis &edge = *edges[currEdge];
|
||||
const WordsRange &sourceRange = edge.GetCurrSourceWordsRange();
|
||||
WordsRange targetRange = path.GetTargetWordsRange(edge);
|
||||
out << " " << sourceRange.GetStartPos();
|
||||
if (sourceRange.GetStartPos() < sourceRange.GetEndPos()) {
|
||||
out << "-" << sourceRange.GetEndPos();
|
||||
}
|
||||
out<< "=" << targetRange.GetStartPos();
|
||||
if (targetRange.GetStartPos() < targetRange.GetEndPos()) {
|
||||
out<< "-" << targetRange.GetEndPos();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (includeWordAlignment) {
|
||||
out << " ||| ";
|
||||
for (int currEdge = (int)edges.size() - 2 ; currEdge >= 0 ; currEdge--) {
|
||||
const Hypothesis &edge = *edges[currEdge];
|
||||
const WordsRange &sourceRange = edge.GetCurrSourceWordsRange();
|
||||
WordsRange targetRange = path.GetTargetWordsRange(edge);
|
||||
const int sourceOffset = sourceRange.GetStartPos();
|
||||
const int targetOffset = targetRange.GetStartPos();
|
||||
const AlignmentInfo &ai = edge.GetCurrTargetPhrase().GetAlignTerm();
|
||||
|
||||
OutputAlignment(out, ai, sourceOffset, targetOffset);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (StaticData::Instance().IsPathRecoveryEnabled()) {
|
||||
out << " ||| ";
|
||||
OutputInput(out, edges[0]);
|
||||
}
|
||||
|
||||
out << endl;
|
||||
}
|
||||
|
||||
out << std::flush;
|
||||
}
|
||||
|
||||
void IOWrapper::OutputAllFeatureScores(const Moses::ScoreComponentCollection &features
|
||||
, std::ostream &out)
|
||||
{
|
||||
|
@ -246,12 +246,6 @@ public:
|
||||
static void OutputAlignment(std::ostream &out, const std::vector<const Hypothesis *> &edges);
|
||||
static void OutputAlignment(std::ostream &out, const Moses::AlignmentInfo &ai, size_t sourceOffset, size_t targetOffset);
|
||||
|
||||
void OutputNBest(std::ostream& out
|
||||
, const Moses::TrellisPathList &nBestList
|
||||
, const std::vector<Moses::FactorType>& outputFactorOrder
|
||||
, long translationId
|
||||
, char reportSegmentation);
|
||||
|
||||
static void OutputAllFeatureScores(const Moses::ScoreComponentCollection &features
|
||||
, std::ostream &out);
|
||||
static void OutputFeatureScores( std::ostream& out
|
||||
|
Loading…
Reference in New Issue
Block a user