mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 22:14:57 +03:00
Fix MosesMT.cpp to work with new mbr interface
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@2641 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
d8864fa6ad
commit
b8789dfd97
@ -116,20 +116,9 @@ class TranslationTask : public Task {
|
||||
if (m_outputCollector) {
|
||||
ostringstream out;
|
||||
ostringstream debug;
|
||||
const Hypothesis* bestHypo = NULL;
|
||||
if (!staticData.UseMBR()) {
|
||||
const Hypothesis* hypo = manager.GetBestHypothesis();
|
||||
if (hypo) {
|
||||
OutputSurface(
|
||||
out,
|
||||
hypo,
|
||||
staticData.GetOutputFactorOrder(),
|
||||
staticData.GetReportSegmentation(),
|
||||
staticData.GetReportAllFactors());
|
||||
IFVERBOSE(1) {
|
||||
debug << "BEST TRANSLATION: " << *hypo << endl;
|
||||
}
|
||||
}
|
||||
out << endl;
|
||||
bestHypo = manager.GetBestHypothesis();
|
||||
} else {
|
||||
//MBR decoding
|
||||
size_t nBestSize = staticData.GetMBRSize();
|
||||
@ -141,16 +130,23 @@ class TranslationTask : public Task {
|
||||
manager.CalcNBest(nBestSize, nBestList,true);
|
||||
VERBOSE(2,"size of n-best: " << nBestList.GetSize() << " (" << nBestSize << ")" << endl);
|
||||
IFVERBOSE(2) { PrintUserTime("calculated n-best list for MBR decoding"); }
|
||||
vector<const Factor*> mbrBestHypo = doMBR(nBestList);
|
||||
for (size_t i = 0 ; i < mbrBestHypo.size() ; i++) {
|
||||
const Factor *factor = mbrBestHypo[i];
|
||||
if (i>0) out << " ";
|
||||
out << factor->GetString();
|
||||
}
|
||||
out << endl;
|
||||
bestHypo = doMBR(nBestList)->GetEdges().at(0);
|
||||
IFVERBOSE(2) { PrintUserTime("finished MBR decoding"); }
|
||||
}
|
||||
}
|
||||
if (bestHypo) {
|
||||
OutputSurface(
|
||||
out,
|
||||
bestHypo,
|
||||
staticData.GetOutputFactorOrder(),
|
||||
staticData.GetReportSegmentation(),
|
||||
staticData.GetReportAllFactors());
|
||||
IFVERBOSE(1) {
|
||||
debug << "BEST TRANSLATION: " << *bestHypo << endl;
|
||||
}
|
||||
}
|
||||
out << endl;
|
||||
|
||||
m_outputCollector->Write(m_lineNumber,out.str(),debug.str());
|
||||
}
|
||||
if (m_nbestCollector) {
|
||||
|
Loading…
Reference in New Issue
Block a user