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/ScoreComponentCollection.cpp | |
parent | 786258cb288e0711a2614bfd36d5ec83353ab5c2 (diff) |
use util::StringStream
Diffstat (limited to 'moses/ScoreComponentCollection.cpp')
-rw-r--r-- | moses/ScoreComponentCollection.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/moses/ScoreComponentCollection.cpp b/moses/ScoreComponentCollection.cpp index 4d79d5565..c3e55b5c7 100644 --- a/moses/ScoreComponentCollection.cpp +++ b/moses/ScoreComponentCollection.cpp @@ -88,9 +88,8 @@ void ScoreComponentCollection::MultiplyEquals(const FeatureFunction* sp, float s { std::string prefix = sp->GetScoreProducerDescription() + FName::SEP; for(FVector::FNVmap::const_iterator i = m_scores.cbegin(); i != m_scores.cend(); i++) { - std::stringstream name; - name << i->first; - if (starts_with(name.str(), prefix)) + const std::string &name = i->first.name(); + if (starts_with(name, prefix)) m_scores[i->first] = i->second * scalar; } } @@ -101,9 +100,8 @@ size_t ScoreComponentCollection::GetNumberWeights(const FeatureFunction* sp) std::string prefix = sp->GetScoreProducerDescription() + FName::SEP; size_t weights = 0; for(FVector::FNVmap::const_iterator i = m_scores.cbegin(); i != m_scores.cend(); i++) { - std::stringstream name; - name << i->first; - if (starts_with(name.str(), prefix)) + const std::string &name = i->first.name(); + if (starts_with(name, prefix)) weights++; } return weights; |