Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-10-02 22:12:39 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-10-16 22:03:22 +0300
commitcfb1ab34c7d3178e4264d5bba876ddef6125e18f (patch)
tree790d5bd02c9d0415ddfbfedec2c1b73aaf3a6fd6 /moses/Syntax
parent786258cb288e0711a2614bfd36d5ec83353ab5c2 (diff)
use util::StringStream
Diffstat (limited to 'moses/Syntax')
-rw-r--r--moses/Syntax/F2S/GlueRuleSynthesizer.cpp6
-rw-r--r--moses/Syntax/T2S/GlueRuleSynthesizer.cpp5
2 files changed, 7 insertions, 4 deletions
diff --git a/moses/Syntax/F2S/GlueRuleSynthesizer.cpp b/moses/Syntax/F2S/GlueRuleSynthesizer.cpp
index 09423f5d3..a181d0b9e 100644
--- a/moses/Syntax/F2S/GlueRuleSynthesizer.cpp
+++ b/moses/Syntax/F2S/GlueRuleSynthesizer.cpp
@@ -4,6 +4,7 @@
#include "moses/FF/UnknownWordPenaltyProducer.h"
#include "moses/StaticData.h"
+#include "util/string_stream.hh"
namespace Moses
{
@@ -55,7 +56,8 @@ TargetPhrase *GlueRuleSynthesizer::SynthesizeTargetPhrase(
TargetPhrase *targetPhrase = new TargetPhrase();
- std::ostringstream alignmentSS;
+ std::string alignmentSSStr;
+ util::StringStream alignmentSS(alignmentSSStr);
for (std::size_t i = 0; i < e.tail.size(); ++i) {
const Word &symbol = e.tail[i]->pvertex.symbol;
if (symbol.IsNonTerminal()) {
@@ -75,7 +77,7 @@ TargetPhrase *GlueRuleSynthesizer::SynthesizeTargetPhrase(
targetPhrase->EvaluateInIsolation(m_dummySourcePhrase);
Word *targetLhs = new Word(staticData.GetOutputDefaultNonTerminal());
targetPhrase->SetTargetLHS(targetLhs);
- targetPhrase->SetAlignmentInfo(alignmentSS.str());
+ targetPhrase->SetAlignmentInfo(alignmentSSStr);
return targetPhrase;
}
diff --git a/moses/Syntax/T2S/GlueRuleSynthesizer.cpp b/moses/Syntax/T2S/GlueRuleSynthesizer.cpp
index 9c6dd91ab..4fed9e9ab 100644
--- a/moses/Syntax/T2S/GlueRuleSynthesizer.cpp
+++ b/moses/Syntax/T2S/GlueRuleSynthesizer.cpp
@@ -47,7 +47,8 @@ TargetPhrase *GlueRuleSynthesizer::SynthesizeTargetPhrase(
TargetPhrase *targetPhrase = new TargetPhrase();
- std::ostringstream alignmentSS;
+ std::string alignmentSSStr;
+ util::StringStream alignmentSS(alignmentSSStr);
for (std::size_t i = 0; i < node.children.size(); ++i) {
const Word &symbol = node.children[i]->pvertex.symbol;
if (symbol.IsNonTerminal()) {
@@ -67,7 +68,7 @@ TargetPhrase *GlueRuleSynthesizer::SynthesizeTargetPhrase(
targetPhrase->EvaluateInIsolation(sourceRhs);
Word *targetLhs = new Word(staticData.GetOutputDefaultNonTerminal());
targetPhrase->SetTargetLHS(targetLhs);
- targetPhrase->SetAlignmentInfo(alignmentSS.str());
+ targetPhrase->SetAlignmentInfo(alignmentSSStr);
return targetPhrase;
}