mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
scores matches. State info from hash
This commit is contained in:
parent
7cb8ef5933
commit
3b0ab6e6de
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user