diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-15 14:37:21 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-15 14:37:21 +0400 |
commit | 0f75865faaf42b7e024879dbfb383f6040482ac7 (patch) | |
tree | dc2fd027b669b1c27bdfa14bf7ba9e6b4c0228b2 /moses/ScoreComponentCollection.cpp | |
parent | 08cf4805166dfa8f60a0938cad450cd9b279ac1a (diff) |
1. Get rid of GetSparseFeatureReporting(). Always report detailed sparse features, if they exist.
2. Name sparse features properly in class WordTranslationFeature
Diffstat (limited to 'moses/ScoreComponentCollection.cpp')
-rw-r--r-- | moses/ScoreComponentCollection.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/moses/ScoreComponentCollection.cpp b/moses/ScoreComponentCollection.cpp index 75241f769..b1b171465 100644 --- a/moses/ScoreComponentCollection.cpp +++ b/moses/ScoreComponentCollection.cpp @@ -194,6 +194,20 @@ void ScoreComponentCollection::ZeroDenseFeatures(const FeatureFunction* sp) Assign(sp, vec); } +//! get subset of scores that belong to a certain sparse ScoreProducer +FVector ScoreComponentCollection::GetVectorForProducer(const FeatureFunction* sp) const +{ + FVector fv(s_denseVectorSize); + 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 (name.str().substr( 0, prefix.length() ).compare( prefix ) == 0) + fv[i->first] = i->second; + } + return fv; +} + } |