From 70a1c886142ed2e9cce716507bb68c9845f1650b Mon Sep 17 00:00:00 2001 From: Ulrich Germann Date: Sun, 26 Jul 2015 21:23:13 +0100 Subject: [PATCH] New dummy bias that always returns 1. Purpose: to keep track of phrase counts per document. If no bias is given, no per-documents counts are stored. --- moses/TranslationModel/UG/mm/ug_sampling_bias.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/moses/TranslationModel/UG/mm/ug_sampling_bias.h b/moses/TranslationModel/UG/mm/ug_sampling_bias.h index ad7735bc1..351d7be8c 100644 --- a/moses/TranslationModel/UG/mm/ug_sampling_bias.h +++ b/moses/TranslationModel/UG/mm/ug_sampling_bias.h @@ -91,5 +91,17 @@ namespace Moses }; + class + SamplingBiasAlways : public SamplingBias + { + public: + SamplingBiasAlways(std::vector const* sid2docid) + : SamplingBias(sid2docid) {} + + float operator[](id_type const idx) { return 1; } + float operator[](id_type const idx) const { return 1; } + size_t size() const { return 0; } + }; + } }