diff options
author | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-02-09 14:37:41 +0300 |
---|---|---|
committer | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-02-09 14:37:41 +0300 |
commit | 2f091ce8f7eed08095b59b5746b8a42c21200458 (patch) | |
tree | 6c0da57b2f163c0e2088c3b7ba8dc01e5883b64c /moses/src/Manager.cpp | |
parent | fd60fe93b9e1bb2f210fbea861d78d7a84b37624 (diff) |
roll forwards james smith's changes.
seg faults seen might have been caused by unknown compiler problem,
or FC5/FC6 lib incompatibility on DICE machines. what a joke!
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1554 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses/src/Manager.cpp')
-rwxr-xr-x | moses/src/Manager.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/moses/src/Manager.cpp b/moses/src/Manager.cpp index 8b9ef579e..f077f5173 100755 --- a/moses/src/Manager.cpp +++ b/moses/src/Manager.cpp @@ -147,10 +147,10 @@ void Manager::ProcessOneHypothesis(const Hypothesis &hypothesis) for (size_t startPos = hypoFirstGapPos ; startPos < sourceSize ; ++startPos) { - size_t maxSize = sourceSize - startPos; - size_t maxSizePhrase = StaticData::Instance().GetMaxPhraseLength(); - maxSize = (maxSize < maxSizePhrase) ? maxSize : maxSizePhrase; - + size_t maxSize = sourceSize - startPos; + size_t maxSizePhrase = StaticData::Instance().GetMaxPhraseLength(); + maxSize = (maxSize < maxSizePhrase) ? maxSize : maxSizePhrase; + for (size_t endPos = startPos ; endPos < startPos + maxSize ; ++endPos) { if (!hypoBitmap.Overlap(WordsRange(startPos, endPos))) @@ -296,6 +296,20 @@ void Manager::ExpandHypothesis(const Hypothesis &hypothesis, const TranslationOp if (debug2) { std::cerr << "::EXT: " << transOpt << "\n"; } #endif Hypothesis *newHypo = hypothesis.CreateNext(transOpt); + // expand hypothesis further if transOpt was linked + for (std::vector<TranslationOption*>::const_iterator iterLinked = transOpt.GetLinkedTransOpts().begin(); + iterLinked != transOpt.GetLinkedTransOpts().end(); iterLinked++) { + const WordsBitmap hypoBitmap = newHypo->GetWordsBitmap(); + if (hypoBitmap.Overlap((**iterLinked).GetSourceWordsRange())) { + // don't want to add a hypothesis that has some but not all of a linked TO set, so return + return; + } + else + { + newHypo->CalcScore(m_transOptColl->GetFutureScore()); + newHypo = newHypo->CreateNext(**iterLinked); + } + } newHypo->CalcScore(m_transOptColl->GetFutureScore()); // logging for the curious |