duplicate n-best stream processing

This commit is contained in:
Hieu Hoang 2014-10-02 18:39:40 +01:00
parent e41d2ba08b
commit 2468e2108a

View File

@ -97,11 +97,15 @@ IOWrapper::IOWrapper(const std::vector<FactorType> &inputFactorOrder
if (nBestSize > 0) {
if (nBestFilePath == "-" || nBestFilePath == "/dev/stdout") {
m_nBestStream = &std::cout;
m_nBestOutputCollector = new Moses::OutputCollector(&std::cout);
m_surpressSingleBestOutput = true;
} else {
std::ofstream *file = new std::ofstream;
m_nBestStream = file;
file->open(nBestFilePath.c_str());
m_nBestStream = file;
m_nBestOutputCollector = new Moses::OutputCollector(file);
//m_nBestOutputCollector->HoldOutputStream();
}
}
@ -117,16 +121,6 @@ IOWrapper::IOWrapper(const std::vector<FactorType> &inputFactorOrder
file->open(fileName.c_str());
}
if (nBestSize > 0) {
if (nBestFilePath == "-") {
m_nBestOutputCollector = new Moses::OutputCollector(&std::cout);
m_surpressSingleBestOutput = true;
} else {
m_nBestOutputCollector = new Moses::OutputCollector(new std::ofstream(nBestFilePath.c_str()));
m_nBestOutputCollector->HoldOutputStream();
}
}
if (!m_surpressSingleBestOutput) {
m_singleBestOutputCollector = new Moses::OutputCollector(&std::cout);
}