summaryrefslogtreecommitdiff
path: root/training/candidate_set.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-05-29 21:39:22 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-05-29 21:39:22 -0400
commit317d650f6cb1e24ac6f3be6f7bf9d4246a59e0e5 (patch)
tree02a8217d6910453049d5a2b96d3214baf19737c5 /training/candidate_set.h
parent6b7f7ae44228221b3de158035d190940ff677de1 (diff)
add support to rampion for accumulating k-best lists
Diffstat (limited to 'training/candidate_set.h')
-rw-r--r--training/candidate_set.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/training/candidate_set.h b/training/candidate_set.h
index 824a4de2..9d326ed0 100644
--- a/training/candidate_set.h
+++ b/training/candidate_set.h
@@ -15,16 +15,25 @@ namespace training {
struct Candidate {
Candidate() {}
Candidate(const std::vector<WordID>& e, const SparseVector<double>& fm) :
- ewords(e),
- fmap(fm) {}
- std::vector<WordID> ewords;
- SparseVector<double> fmap;
- SufficientStats score_stats;
+ ewords(e),
+ fmap(fm) {}
+ Candidate(const std::vector<WordID>& e,
+ const SparseVector<double>& fm,
+ const SegmentEvaluator& se) :
+ ewords(e),
+ fmap(fm) {
+ se.Evaluate(ewords, &eval_feats);
+ }
+
void swap(Candidate& other) {
- score_stats.swap(other.score_stats);
+ eval_feats.swap(other.eval_feats);
ewords.swap(other.ewords);
fmap.swap(other.fmap);
}
+
+ std::vector<WordID> ewords;
+ SparseVector<double> fmap;
+ SufficientStats eval_feats;
};
// represents some kind of collection of translation candidates, e.g.