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);