From bee6a3c3f6c54cf7449229488c6124dddc7e2f31 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Tue, 18 Jan 2011 15:55:40 -0500 Subject: new version of klm --- klm/lm/search_hashed.hh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'klm/lm/search_hashed.hh') diff --git a/klm/lm/search_hashed.hh b/klm/lm/search_hashed.hh index 1ee2b9e9..6dc11fb3 100644 --- a/klm/lm/search_hashed.hh +++ b/klm/lm/search_hashed.hh @@ -17,10 +17,11 @@ namespace util { class FilePiece; } namespace lm { namespace ngram { +struct Backing; namespace detail { inline uint64_t CombineWordHash(uint64_t current, const WordIndex next) { - uint64_t ret = (current * 8978948897894561157ULL) ^ (static_cast(next) * 17894857484156487943ULL); + uint64_t ret = (current * 8978948897894561157ULL) ^ (static_cast(1 + next) * 17894857484156487943ULL); return ret; } @@ -91,7 +92,7 @@ template struct TemplateHashedSearch : public Ha return start; } - template void InitializeFromARPA(const char *file, util::FilePiece &f, const std::vector &counts, const Config &config, Voc &vocab); + template void InitializeFromARPA(const char *file, util::FilePiece &f, const std::vector &counts, const Config &config, Voc &vocab, Backing &backing); bool LookupMiddle(const Middle &middle, WordIndex word, float &prob, float &backoff, Node &node) const { node = CombineWordHash(node, word); @@ -145,6 +146,8 @@ struct ProbingHashedSearch : public TemplateHashedSearch< struct SortedHashedSearch : public TemplateHashedSearch< util::SortedUniformMap >, util::SortedUniformMap > > { + + SortedHashedSearch(); static const ModelType kModelType = HASH_SORTED; }; -- cgit v1.2.3