From 1c8b1d6056f0c33a61e8facb60519f6ae1e7fcfc Mon Sep 17 00:00:00 2001 From: Paco Zamora Martinez Date: Fri, 8 Jul 2016 18:31:17 +0200 Subject: [PATCH] Updated hashCode generation at NeuralLMWrapper.cpp; changed it to consider the last n-1 words instead of the whole ngram n words --- moses/LM/NeuralLMWrapper.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/moses/LM/NeuralLMWrapper.cpp b/moses/LM/NeuralLMWrapper.cpp index 634f66e7d..91107a9a2 100644 --- a/moses/LM/NeuralLMWrapper.cpp +++ b/moses/LM/NeuralLMWrapper.cpp @@ -54,16 +54,21 @@ LMResult NeuralLMWrapper::GetValue(const vector &contextFactor, Sta //TODO: config option? m_neuralLM->set_cache(1000000); } - size_t hashCode = 0; - + vector words(contextFactor.size()); - for (size_t i=0, n=contextFactor.size(); iGetFactor(m_factorType); const std::string string = factor->GetString().as_string(); int neuralLM_wordID = m_neuralLM->lookup_word(string); words[i] = neuralLM_wordID; - boost::hash_combine(hashCode, neuralLM_wordID); + } + // Generate hashCode for only the last n-1 words, that represents the next LM + // state + size_t hashCode = 0; + for (size_t i=1; ilookup_ngram(words);