From 42fc86b259498d99d75e4fd956e74ecd8888440a Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Sun, 8 Sep 2013 17:02:59 +0200 Subject: [PATCH] lattice decoding with sparse features --- moses/ScoreComponentCollection.cpp | 10 +++++----- moses/ScoreComponentCollection.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/moses/ScoreComponentCollection.cpp b/moses/ScoreComponentCollection.cpp index d3c31d625..7cd9be701 100644 --- a/moses/ScoreComponentCollection.cpp +++ b/moses/ScoreComponentCollection.cpp @@ -11,15 +11,15 @@ namespace Moses void ScorePair::PlusEquals(const ScorePair &other) { PlusEquals(other.denseScores); - std::map::const_iterator iter; + std::map::const_iterator iter; for (iter = other.sparseScores.begin(); iter != other.sparseScores.end(); ++iter) { PlusEquals(iter->first, iter->second); } } -void ScorePair::PlusEquals(const std::string &key, float value) +void ScorePair::PlusEquals(const StringPiece &key, float value) { - std::map::iterator iter; + std::map::iterator iter; iter = sparseScores.find(key); if (iter == sparseScores.end()) { sparseScores[key] = value; @@ -245,9 +245,9 @@ void ScoreComponentCollection::PlusEquals(const FeatureFunction* sp, const Score { PlusEquals(sp, scorePair.denseScores); - std::map::const_iterator iter; + std::map::const_iterator iter; for (iter = scorePair.sparseScores.begin(); iter != scorePair.sparseScores.end(); ++iter) { - const string &key = iter->first; + const StringPiece &key = iter->first; float value = iter->second; PlusEquals(sp, key, value); } diff --git a/moses/ScoreComponentCollection.h b/moses/ScoreComponentCollection.h index b3620fd94..08a6eb927 100644 --- a/moses/ScoreComponentCollection.h +++ b/moses/ScoreComponentCollection.h @@ -47,10 +47,10 @@ namespace Moses struct ScorePair { std::vector denseScores; - std::map sparseScores; + std::map sparseScores; void PlusEquals(const ScorePair &other); - void PlusEquals(const std::string &key, float value); + void PlusEquals(const StringPiece &key, float value); void PlusEquals(const std::vector &other) {