From 3b0ab6e6de466dfb30ba1332faf999c8fa2c86b4 Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Tue, 15 Jul 2014 17:14:32 +0100 Subject: [PATCH] scores matches. State info from hash --- moses/LM/oxlm/LBLLM2.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/moses/LM/oxlm/LBLLM2.h b/moses/LM/oxlm/LBLLM2.h index 7346788e4..4026b28c6 100644 --- a/moses/LM/oxlm/LBLLM2.h +++ b/moses/LM/oxlm/LBLLM2.h @@ -2,6 +2,7 @@ #pragma once #include +#include #include "moses/LM/SingleFactor.h" #include "moses/FactorCollection.h" @@ -91,7 +92,15 @@ public: ret.score = score; ret.unknown = (word == kUNKNOWN); - (*finalState) = (State*) 0; + // calc state from hash of last n-1 words + size_t seed = 0; + boost::hash_combine(seed, word); + for (size_t i = 0; i < context.size() && i < context_width - 1; ++i) { + int id = context[i]; + boost::hash_combine(seed, id); + } + + (*finalState) = (State*) seed; return ret; }