diff options
author | Patrick Simianer <p@simianer.de> | 2011-09-25 20:23:09 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2011-09-25 20:23:09 +0200 |
commit | fe471bb707226052551d75b043295ca5f57261c0 (patch) | |
tree | 73ba37bf8d5c1de6de50f63888a49e918e4a8cd4 /dtrain/ksampler.h | |
parent | 5e1ab3481551607f1c2a10027049044cd41f78ab (diff) |
removed some quirks, less boost, prettier code, score_t
Diffstat (limited to 'dtrain/ksampler.h')
-rw-r--r-- | dtrain/ksampler.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/dtrain/ksampler.h b/dtrain/ksampler.h index 914e9723..ac88b643 100644 --- a/dtrain/ksampler.h +++ b/dtrain/ksampler.h @@ -1,21 +1,22 @@ #ifndef _DTRAIN_KSAMPLER_H_ #define _DTRAIN_KSAMPLER_H_ -#include "kbest.h" #include "hgsampler.h" +#include "kbest.h" // cdec #include "sampler.h" namespace dtrain { + /* * KSampler * */ -struct KSampler : public DecoderObserver +struct KSampler : public HypoSampler { const size_t k_; - KBestList kb; + Samples s; MT19937* rng; explicit KSampler( const size_t k, MT19937* prng ) : @@ -27,19 +28,19 @@ struct KSampler : public DecoderObserver Sample( *hg ); } - KBestList* GetKBest() { return &kb; } + Samples* GetSamples() { return &s; } void Sample( const Hypergraph& forest ) { - kb.sents.clear(); - kb.feats.clear(); - kb.model_scores.clear(); - kb.scores.clear(); + s.sents.clear(); + s.feats.clear(); + s.model_scores.clear(); + s.scores.clear(); std::vector<HypergraphSampler::Hypothesis> samples; HypergraphSampler::sample_hypotheses(forest, k_, rng, &samples); for ( size_t i = 0; i < k_; ++i ) { - kb.sents.push_back( samples[i].words ); - kb.feats.push_back( samples[i].fmap ); - kb.model_scores.push_back( log(samples[i].model_score) ); + s.sents.push_back( samples[i].words ); + s.feats.push_back( samples[i].fmap ); + s.model_scores.push_back( log(samples[i].model_score) ); } } }; @@ -47,6 +48,5 @@ struct KSampler : public DecoderObserver } // namespace - #endif |