Skip to content

Commit

Permalink
unk penalty must also have a active chart entry so that it can share …
Browse files Browse the repository at this point in the history
…symbolbin with inputPath
  • Loading branch information
hieuhoang committed Aug 17, 2016
1 parent 682bba4 commit 3da0b1a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions contrib/moses2/TranslationModel/UnknownWordPenalty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "../SCFG/TargetPhraseImpl.h"
#include "../SCFG/Manager.h"
#include "../SCFG/Sentence.h"
#include "../SCFG/ActiveChart.h"

using namespace std;

Expand Down Expand Up @@ -185,8 +186,9 @@ void UnknownWordPenalty::Lookup(MemPool &pool,
size_t endPos = path.range.GetEndPos();
const SCFG::InputPath &subPhrasePath = *mgr.GetInputPaths().GetMatrix().GetValue(endPos, 1);

SCFG::SymbolBind symbolBind(pool);
symbolBind.Add(subPhrasePath.range, lastWord, NULL);
SCFG::ActiveChartEntry *chartEntry = new (pool.Allocate<SCFG::ActiveChartEntry>()) SCFG::ActiveChartEntry(pool);
chartEntry->AddSymbolBindElement(subPhrasePath.range, lastWord, NULL, *this);
path.AddActiveChartEntry(GetPtInd(), chartEntry);

Scores &scores = tp->GetScores();
scores.PlusEquals(mgr.system, *this, -100);
Expand All @@ -198,7 +200,7 @@ void UnknownWordPenalty::Lookup(MemPool &pool,
SCFG::TargetPhrases *tps = new (pool.Allocate<SCFG::TargetPhrases>()) SCFG::TargetPhrases(pool);
tps->AddTargetPhrase(*tp);

path.AddTargetPhrasesToPath(pool, mgr.system, *this, *tps, symbolBind);
path.AddTargetPhrasesToPath(pool, mgr.system, *this, *tps, chartEntry->GetSymbolBind());
}

void UnknownWordPenalty::LookupUnary(MemPool &pool,
Expand Down

0 comments on commit 3da0b1a

Please sign in to comment.