diff options
author | Ales Tamchyna <tamchyna@ufal.mff.cuni.cz> | 2016-03-23 19:37:19 +0300 |
---|---|---|
committer | Ales Tamchyna <tamchyna@ufal.mff.cuni.cz> | 2016-03-23 19:37:19 +0300 |
commit | 073f9c56565ab9490329f81af1103d38eb720ccf (patch) | |
tree | db518959be3f42ab20288a28ffd98346da08be9b /moses/FF | |
parent | c7a1d21abda7d8b28e200ab7e5ed17697400c01b (diff) |
bugfix in context hash
Diffstat (limited to 'moses/FF')
-rw-r--r-- | moses/FF/VW/VW.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/moses/FF/VW/VW.cpp b/moses/FF/VW/VW.cpp index 2ea49aae8..112a6ed1c 100644 --- a/moses/FF/VW/VW.cpp +++ b/moses/FF/VW/VW.cpp @@ -108,20 +108,21 @@ FFState* VW::EvaluateWhenApplied( Discriminative::Classifier &classifier = *m_tlsClassifier->GetStored(); // extract target context features - const Phrase &targetContext = prevVWState.GetPhrase(); + size_t contextHash = prevVWState.hash(); FeatureVectorMap &contextFeaturesCache = *m_tlsTargetContextFeatures->GetStored(); - FeatureVectorMap::const_iterator contextIt = contextFeaturesCache.find(cacheKey); + FeatureVectorMap::const_iterator contextIt = contextFeaturesCache.find(contextHash); if (contextIt == contextFeaturesCache.end()) { // we have not extracted features for this context yet + const Phrase &targetContext = prevVWState.GetPhrase(); Discriminative::FeatureVector contextVector; AlignmentInfo alignInfo(""); for(size_t i = 0; i < contextFeatures.size(); ++i) (*contextFeatures[i])(input, targetContext, alignInfo, classifier, contextVector); - contextFeaturesCache[cacheKey] = contextVector; + contextFeaturesCache[contextHash] = contextVector; VERBOSE(3, "VW :: context cache miss\n"); } else { // context already in cache, simply put feature IDs in the classifier object |