diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2013-07-23 04:32:25 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2013-07-23 04:32:25 +0400 |
commit | 42c1c908a506a51d728474e9b26c9d4119ec08df (patch) | |
tree | 029bd8b5ebb73d8078753d9edc94deb41c89f4b9 /moses/FF/ControlRecombination.cpp | |
parent | 25906017088dccdf850ccd9ce11aa0629b8a9457 (diff) |
add ControlRecombination feature function
Diffstat (limited to 'moses/FF/ControlRecombination.cpp')
-rw-r--r-- | moses/FF/ControlRecombination.cpp | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/moses/FF/ControlRecombination.cpp b/moses/FF/ControlRecombination.cpp index daebba9a3..0ea78fa64 100644 --- a/moses/FF/ControlRecombination.cpp +++ b/moses/FF/ControlRecombination.cpp @@ -58,30 +58,12 @@ int ControlRecombinationState::Compare(const FFState& other) const const ControlRecombinationState &other2 = static_cast<const ControlRecombinationState&>(other); const Hypothesis *otherHypo = other2.m_hypo; - const TargetPhrase *thisTargetPhrase = &m_hypo->GetCurrTargetPhrase(); - const TargetPhrase *otherTargetPhrase = &otherHypo->GetCurrTargetPhrase(); + const Phrase thisOutputPhrase, otherOutputPhrase; + m_hypo->GetOutputPhrase(thisOutputPhrase); + otherHypo->GetOutputPhrase(otherOutputPhrase); - int thisSize = thisTargetPhrase->GetSize(); - int otherPos = otherTargetPhrase->GetSize() - 1; - for (int thisPos = thisSize - 1; thisPos >= 0; --thisPos && --otherPos) { - if (otherPos < 0) { - otherHypo = otherHypo->GetPrevHypo(); - if (otherHypo == NULL) { - return -1; - } - otherTargetPhrase = &otherHypo->GetCurrTargetPhrase(); - otherPos = otherTargetPhrase->GetSize() - 1; - } - - const Word &thisWord = thisTargetPhrase->GetWord(thisPos); - const Word &otherWord = otherTargetPhrase->GetWord(otherPos); - int compare = thisWord.Compare(otherWord); - if (compare) { - return compare; - } - } - - return 0; + int ret = thisOutputPhrase.Compare(otherOutputPhrase); + return ret; } } |