diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-08 18:34:56 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-08 18:34:56 +0400 |
commit | 4890e4673a80880ec890c291e992105775b98434 (patch) | |
tree | 54075d799e7d9afa1598dd57679cec4ab2db844e /moses/ScoreComponentCollection.h | |
parent | 9081479f88566f511f17e732e3209e16ee48bb36 (diff) |
get rid of FeatureFunction::unlimited. Every ff can have sparse AND dense features
Diffstat (limited to 'moses/ScoreComponentCollection.h')
-rw-r--r-- | moses/ScoreComponentCollection.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/moses/ScoreComponentCollection.h b/moses/ScoreComponentCollection.h index 82d4d702a..9d781af54 100644 --- a/moses/ScoreComponentCollection.h +++ b/moses/ScoreComponentCollection.h @@ -106,7 +106,6 @@ public: * be allocated space in the dense part of the feature vector. **/ static void RegisterScoreProducer(const FeatureFunction* scoreProducer); - static void UnregisterScoreProducer(const FeatureFunction* scoreProducer); /** Load from file */ bool Load(const std::string& filename) @@ -194,7 +193,6 @@ public: //For features which have an unbounded number of components void MinusEquals(const FeatureFunction*sp, const std::string& name, float score) { - assert(sp->GetNumScoreComponents() == FeatureFunction::unlimited); FName fname(sp->GetScoreProducerDescription(),name); m_scores[fname] -= score; } @@ -242,7 +240,6 @@ public: //For features which have an unbounded number of components void PlusEquals(const FeatureFunction*sp, const std::string& name, float score) { - CHECK(sp->GetNumScoreComponents() == FeatureFunction::unlimited); FName fname(sp->GetScoreProducerDescription(),name); m_scores[fname] += score; } @@ -250,7 +247,6 @@ public: //For features which have an unbounded number of components void PlusEquals(const FeatureFunction*sp, const StringPiece& name, float score) { - CHECK(sp->GetNumScoreComponents() == FeatureFunction::unlimited); FName fname(sp->GetScoreProducerDescription(),name); m_scores[fname] += score; } @@ -289,7 +285,6 @@ public: //For features which have an unbounded number of components void Assign(const FeatureFunction*sp, const std::string name, float score) { - CHECK(sp->GetNumScoreComponents() == FeatureFunction::unlimited); FName fname(sp->GetScoreProducerDescription(),name); m_scores[fname] = score; } @@ -321,7 +316,8 @@ public: std::vector<float> GetScoresForProducer(const FeatureFunction* sp) const { size_t components = sp->GetNumScoreComponents(); - if (components == FeatureFunction::unlimited) return std::vector<float>(); + assert(components > 0); + std::vector<float> res(components); IndexPair indexes = GetIndexes(sp); for (size_t i = 0; i < res.size(); ++i) { @@ -386,7 +382,6 @@ public: float GetScoreForProducer (const FeatureFunction* sp, const std::string& name) const { - CHECK(sp->GetNumScoreComponents() == FeatureFunction::unlimited); FName fname(sp->GetScoreProducerDescription(),name); return m_scores[fname]; } |