scores matches. State info from hash

This commit is contained in:
Hieu Hoang 2014-07-15 17:14:32 +01:00
parent 7cb8ef5933
commit 3b0ab6e6de

View File

@ -2,6 +2,7 @@
#pragma once
#include <vector>
#include <boost/functional/hash.hpp>
#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;
}