summaryrefslogtreecommitdiff
path: root/extractor/scorer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'extractor/scorer.cc')
-rw-r--r--extractor/scorer.cc21
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;
}