diff options
author | Paul Baltescu <pauldb89@gmail.com> | 2013-02-01 16:11:10 +0000 |
---|---|---|
committer | Paul Baltescu <pauldb89@gmail.com> | 2013-02-01 16:11:10 +0000 |
commit | 0a53f7eca74c165b5ce1c238f1999ddf1febea55 (patch) | |
tree | 5a5231767bc2f92203711ab4aee75336b8bc2175 /extractor/scorer.cc | |
parent | 5530575ae0ad939e17f08d6bd49978acea388ab7 (diff) |
Second working commit.
Diffstat (limited to 'extractor/scorer.cc')
-rw-r--r-- | extractor/scorer.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/extractor/scorer.cc b/extractor/scorer.cc index 22d5be1a..c87e179d 100644 --- a/extractor/scorer.cc +++ b/extractor/scorer.cc @@ -1,9 +1,22 @@ #include "scorer.h" -Scorer::Scorer(const vector<Feature*>& features) : features(features) {} +#include "features/feature.h" -Scorer::~Scorer() { - for (Feature* feature: features) { - delete feature; +Scorer::Scorer(const vector<shared_ptr<Feature> >& features) : + features(features) {} + +vector<double> Scorer::Score(const FeatureContext& context) const { + vector<double> scores; + for (auto feature: features) { + scores.push_back(feature->Score(context)); + } + return scores; +} + +vector<string> Scorer::GetFeatureNames() const { + vector<string> feature_names; + for (auto feature: features) { + feature_names.push_back(feature->GetName()); } + return feature_names; } |