Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'moses/src/RuleTable/PhraseDictionarySCFG.cpp')
-rw-r--r--moses/src/RuleTable/PhraseDictionarySCFG.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/moses/src/RuleTable/PhraseDictionarySCFG.cpp b/moses/src/RuleTable/PhraseDictionarySCFG.cpp
index 3fb7f0cc7..e000deee4 100644
--- a/moses/src/RuleTable/PhraseDictionarySCFG.cpp
+++ b/moses/src/RuleTable/PhraseDictionarySCFG.cpp
@@ -55,8 +55,10 @@ PhraseDictionaryNodeSCFG &PhraseDictionarySCFG::GetOrCreateNode(const Phrase &so
{
const size_t size = source.GetSize();
+ const AlignmentInfo &alignmentInfo = target.GetAlignmentInfo();
+ AlignmentInfo::const_iterator iterAlign = alignmentInfo.begin();
+
PhraseDictionaryNodeSCFG *currNode = &m_collection;
- map<size_t, size_t> sourceToTargetMap(target.GetAlignmentInfo().begin(), target.GetAlignmentInfo().end());
for (size_t pos = 0 ; pos < size ; ++pos) {
const Word& word = source.GetWord(pos);
@@ -64,9 +66,10 @@ PhraseDictionaryNodeSCFG &PhraseDictionarySCFG::GetOrCreateNode(const Phrase &so
// indexed by source label 1st
const Word &sourceNonTerm = word;
- map<size_t, size_t>::const_iterator iterAlign = sourceToTargetMap.find(pos);
- CHECK(iterAlign != sourceToTargetMap.end());
+ CHECK(iterAlign != target.GetAlignmentInfo().end());
+ CHECK(iterAlign->first == pos);
size_t targetNonTermInd = iterAlign->second;
+ ++iterAlign;
const Word &targetNonTerm = target.GetWord(targetNonTermInd);
currNode = currNode->GetOrCreateChild(sourceNonTerm, targetNonTerm);