mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-01 16:33:16 +03:00
fixed precision
This commit is contained in:
parent
dffe9c2cca
commit
6db5165038
@ -11,6 +11,7 @@
|
||||
#include "legacy/Parameter.h"
|
||||
#include "legacy/ThreadPool.h"
|
||||
#include "legacy/Timer.h"
|
||||
#include "legacy/Util2.h"
|
||||
#include "util/usage.hh"
|
||||
|
||||
using namespace std;
|
||||
|
@ -158,7 +158,7 @@ void Hypothesis::OutputToStream(std::ostream &out) const
|
||||
out << m_path->range.GetStartPos() << "-" << m_path->range.GetEndPos() << ",";
|
||||
|
||||
// score breakdown
|
||||
out << m_scores->Debug(m_mgr->system);
|
||||
m_scores->OutputBreakdown(out, m_mgr->system);
|
||||
|
||||
out << "| ";
|
||||
}
|
||||
|
@ -192,6 +192,8 @@ void Manager::CalcFutureScore()
|
||||
std::string Manager::OutputBest() const
|
||||
{
|
||||
stringstream out;
|
||||
Moses2::FixPrecision(out);
|
||||
|
||||
const Hypothesis *bestHypo = m_search->GetBestHypo();
|
||||
if (bestHypo) {
|
||||
if (system.options.output.ReportHypoScore) {
|
||||
@ -225,6 +227,8 @@ std::string Manager::OutputNBest()
|
||||
|
||||
// MAIN LOOP
|
||||
stringstream out;
|
||||
Moses2::FixPrecision(out);
|
||||
|
||||
size_t maxIter = system.options.nbest.nbest_size * system.options.nbest.factor;
|
||||
size_t bestInd = 0;
|
||||
for (size_t i = 0; i < maxIter; ++i) {
|
||||
|
@ -319,6 +319,8 @@ std::string Manager::OutputBest() const
|
||||
//cerr << "BEST TRANSLATION: " << bestHypo << bestHypo->Debug(system) << endl;
|
||||
//cerr << " " << out.str() << endl;
|
||||
stringstream outStrm;
|
||||
Moses2::FixPrecision(outStrm);
|
||||
|
||||
bestHypo->OutputToStream(outStrm);
|
||||
|
||||
out = outStrm.str();
|
||||
@ -342,6 +344,7 @@ std::string Manager::OutputBest() const
|
||||
std::string Manager::OutputNBest()
|
||||
{
|
||||
stringstream out;
|
||||
Moses2::FixPrecision(out);
|
||||
|
||||
arcLists.Sort();
|
||||
|
||||
|
@ -340,5 +340,12 @@ S& Container(std::priority_queue<T, S, C>& q)
|
||||
|
||||
#define HERE __FILE__ << ":" << __LINE__
|
||||
|
||||
/** Enforce rounding */
|
||||
inline void FixPrecision(std::ostream& stream, size_t size = 3)
|
||||
{
|
||||
stream.setf(std::ios::fixed);
|
||||
stream.precision(size);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user