From 3b9de9297b69bc74c1dd9d76d59253667ff58cc5 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 10 Feb 2011 20:51:47 -0500 Subject: kenlm fix --- klm/lm/search_hashed.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'klm') diff --git a/klm/lm/search_hashed.cc b/klm/lm/search_hashed.cc index 00d03f4e..f97ec790 100644 --- a/klm/lm/search_hashed.cc +++ b/klm/lm/search_hashed.cc @@ -95,13 +95,14 @@ template template void TemplateHashe ReadNGrams(f, n, counts[n-1], vocab, middle, ActivateLowerMiddle(middle[n-3]), middle[n-2]); } if (counts.size() > 2) { - ReadNGrams(f, counts.size(), counts[counts.size() - 1], vocab, middle, ActivateUnigram(unigram.Raw()), longest); - } else { ReadNGrams(f, counts.size(), counts[counts.size() - 1], vocab, middle, ActivateLowerMiddle(middle.back()), longest); + } else { + ReadNGrams(f, counts.size(), counts[counts.size() - 1], vocab, middle, ActivateUnigram(unigram.Raw()), longest); } } catch (util::ProbingSizeException &e) { UTIL_THROW(util::ProbingSizeException, "Avoid pruning n-grams like \"bar baz quux\" when \"foo bar baz quux\" is still in the model. KenLM will work when this pruning happens, but the probing model assumes these events are rare enough that using blank space in the probing hash table will cover all of them. Increase probing_multiplier (-p to build_binary) to add more blank spaces.\n"); } + ReadEnd(f); } template void TemplateHashedSearch::InitializeFromARPA(const char *, util::FilePiece &f, const std::vector &counts, const Config &, ProbingVocabulary &vocab, Backing &backing); -- cgit v1.2.3