diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-02 22:12:39 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-10-16 22:03:22 +0300 |
commit | cfb1ab34c7d3178e4264d5bba876ddef6125e18f (patch) | |
tree | 790d5bd02c9d0415ddfbfedec2c1b73aaf3a6fd6 /moses/TranslationAnalysis.cpp | |
parent | 786258cb288e0711a2614bfd36d5ec83353ab5c2 (diff) |
use util::StringStream
Diffstat (limited to 'moses/TranslationAnalysis.cpp')
-rw-r--r-- | moses/TranslationAnalysis.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/moses/TranslationAnalysis.cpp b/moses/TranslationAnalysis.cpp index ed948f6b6..e01bc71e5 100644 --- a/moses/TranslationAnalysis.cpp +++ b/moses/TranslationAnalysis.cpp @@ -10,6 +10,7 @@ #include "moses/FF/StatefulFeatureFunction.h" #include "moses/FF/StatelessFeatureFunction.h" #include "moses/LM/Base.h" +#include "util/string_stream.hh" using namespace Moses; @@ -40,8 +41,11 @@ void PrintTranslationAnalysis(std::ostream &os, const Hypothesis* hypo) if (doLMStats) lmAcc.resize((*tpi)->GetLMStats()->size(), 0); for (; tpi != translationPath.end(); ++tpi) { - std::ostringstream sms; - std::ostringstream tms; + std::string smsStr; + util::StringStream sms(smsStr); + + std::string tmsStr; + util::StringStream tms(tmsStr); std::string target = (*tpi)->GetTargetPhraseStringRep(); std::string source = (*tpi)->GetSourcePhraseStringRep(); WordsRange twr = (*tpi)->GetCurrTargetWordsRange(); @@ -89,8 +93,8 @@ void PrintTranslationAnalysis(std::ostream &os, const Hypothesis* hypo) for (; swr_i <= swr.GetEndPos() && swr.GetEndPos() != NOT_FOUND; swr_i++) { tms << '-' << swr_i; } - if (!epsilon) targetMap.push_back(sms.str()); - sourceMap.push_back(tms.str()); + if (!epsilon) targetMap.push_back(smsStr); + sourceMap.push_back(tmsStr); } std::vector<std::string>::iterator si = sourceMap.begin(); std::vector<std::string>::iterator ti = targetMap.begin(); |