From 0ac66e310d57f9aea5ddeea900c84df08abfe8c2 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Fri, 27 Apr 2012 01:54:47 +0200 Subject: fix approx. BLEU of (Chiang et al. '08) --- dtrain/ksampler.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dtrain/ksampler.h') diff --git a/dtrain/ksampler.h b/dtrain/ksampler.h index eb4813ab..0783f98b 100644 --- a/dtrain/ksampler.h +++ b/dtrain/ksampler.h @@ -15,13 +15,15 @@ struct KSampler : public HypSampler vector s_; MT19937* prng_; score_t (*scorer)(NgramCounts&, const unsigned, const unsigned, unsigned, vector); + unsigned src_len_; explicit KSampler(const unsigned k, MT19937* prng) : k_(k), prng_(prng) {} virtual void - NotifyTranslationForest(const SentenceMetadata& /*smeta*/, Hypergraph* hg) + NotifyTranslationForest(const SentenceMetadata& smeta, Hypergraph* hg) { + src_len_ = smeta.GetSourceLength(); ScoredSamples(*hg); } @@ -37,7 +39,7 @@ struct KSampler : public HypSampler h.f = samples[i].fmap; h.model = log(samples[i].model_score); h.rank = i; - h.score = scorer_->Score(h.w, *ref_, i); + h.score = scorer_->Score(h.w, *ref_, i, src_len_); s_.push_back(h); } } -- cgit v1.2.3