diff options
author | Matthias Huck <huck@i6.informatik.rwth-aachen.de> | 2015-01-09 17:03:18 +0300 |
---|---|---|
committer | Matthias Huck <huck@i6.informatik.rwth-aachen.de> | 2015-01-09 17:03:18 +0300 |
commit | 168118d2524c6397864fd4e93fb35cbc08cc20a0 (patch) | |
tree | 33624adfab06b2d901fea8bf37ce5949d204ad21 /moses/FF/PhraseOrientationFeature.cpp | |
parent | 52eac4058f715ab2275ec3620ba0236f593a5907 (diff) |
PhraseOrientationFeature efficiency improvement
Diffstat (limited to 'moses/FF/PhraseOrientationFeature.cpp')
-rw-r--r-- | moses/FF/PhraseOrientationFeature.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/moses/FF/PhraseOrientationFeature.cpp b/moses/FF/PhraseOrientationFeature.cpp index 8401b326f..86a6d09ce 100644 --- a/moses/FF/PhraseOrientationFeature.cpp +++ b/moses/FF/PhraseOrientationFeature.cpp @@ -69,27 +69,27 @@ FFState* PhraseOrientationFeature::EvaluateWhenApplied( // const Factor* targetLHS = currTarPhr.GetTargetLHS()[0]; // bool isGlueGrammarRule = false; - FEATUREVERBOSE(2, *currSrcPhr << std::endl); - FEATUREVERBOSE(2, currTarPhr << std::endl); - - Moses::GHKM::Alignment alignment; // TODO: Efficiency! It's not necessary to fill a Moses::GHKM::Alignment object and then touch everything again in Moses::GHKM::PhraseOrientation's constructor - - for (AlignmentInfo::const_iterator it=currTarPhr.GetAlignTerm().begin(); - it!=currTarPhr.GetAlignTerm().end(); ++it) + IFFEATUREVERBOSE(2) { - alignment.push_back(std::make_pair(it->first, it->second)); - FEATUREVERBOSE(2, "alignTerm " << it->first << " " << it->second << std::endl); - } + FEATUREVERBOSE(2, *currSrcPhr << std::endl); + FEATUREVERBOSE(2, currTarPhr << std::endl); - for (AlignmentInfo::const_iterator it=currTarPhr.GetAlignNonTerm().begin(); - it!=currTarPhr.GetAlignNonTerm().end(); ++it) - { - alignment.push_back(std::make_pair(it->first, it->second)); - FEATUREVERBOSE(2, "alignNonTerm " << it->first << " " << it->second << std::endl); + for (AlignmentInfo::const_iterator it=currTarPhr.GetAlignTerm().begin(); + it!=currTarPhr.GetAlignTerm().end(); ++it) + { + FEATUREVERBOSE(2, "alignTerm " << it->first << " " << it->second << std::endl); + } + + for (AlignmentInfo::const_iterator it=currTarPhr.GetAlignNonTerm().begin(); + it!=currTarPhr.GetAlignNonTerm().end(); ++it) + { + FEATUREVERBOSE(2, "alignNonTerm " << it->first << " " << it->second << std::endl); + } } // Initialize phrase orientation scoring object - Moses::GHKM::PhraseOrientation phraseOrientation(currSrcPhr->GetSize(), currTarPhr.GetSize(), alignment); // TODO: Efficiency! This should be precomputed. + Moses::GHKM::PhraseOrientation phraseOrientation(currSrcPhr->GetSize(), currTarPhr.GetSize(), + currTarPhr.GetAlignTerm(), currTarPhr.GetAlignNonTerm()); // Get index map for underlying hypotheses const AlignmentInfo::NonTermIndexMap &nonTermIndexMap = |