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:
authorHieu Hoang <hieu@hoang.co.uk>2013-10-03 20:29:07 +0400
committerHieu Hoang <hieu@hoang.co.uk>2013-10-03 20:29:07 +0400
commita41dbeba46cd9dd0eb0135461464a49e79ac96b5 (patch)
tree3b01f0503691aba7e74c705877ca7aeb8d27fb53 /moses/TranslationOptionCollectionLattice.cpp
parent73513c182dd3e12abf4a1df82a7e7808e3dfab83 (diff)
correct creation of input paths for lattices
Diffstat (limited to 'moses/TranslationOptionCollectionLattice.cpp')
-rw-r--r--moses/TranslationOptionCollectionLattice.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/moses/TranslationOptionCollectionLattice.cpp b/moses/TranslationOptionCollectionLattice.cpp
index 45a417ccb..63e952e72 100644
--- a/moses/TranslationOptionCollectionLattice.cpp
+++ b/moses/TranslationOptionCollectionLattice.cpp
@@ -55,13 +55,9 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
}
}
- // subphrases of 2+ words
- for (size_t phaseSize = 2; phaseSize <= size; ++phaseSize) {
- for (size_t startPos = 0; startPos < size - phaseSize + 1; ++startPos) {
- size_t endPos = startPos + phaseSize -1;
-
+ // iterately extend all paths
+ for (size_t endPos = 1; endPos < size; ++endPos) {
const std::vector<size_t> &nextNodes = input.GetNextNodes(endPos);
- const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);
// loop thru every previous paths
size_t numPrevPaths = m_phraseDictionaryQueue.size();
@@ -75,7 +71,9 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
continue;
}
- WordsRange range(prevPath.GetWordsRange().GetStartPos(), endPos);
+ size_t startPos = prevPath.GetWordsRange().GetStartPos();
+ WordsRange range(startPos, endPos);
+ const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);
const Phrase &prevPhrase = prevPath.GetPhrase();
const ScorePair *prevInputScore = prevPath.GetInputScore();
@@ -98,21 +96,11 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
size_t nextNode = nextNodes[i];
path->SetNextNode(nextNode);
- cerr << *path << endl;
-
m_phraseDictionaryQueue.push_back(path);
} // for (size_t i = 0; i < col.size(); ++i) {
} // for (size_t i = 0; i < numPrevPaths; ++i) {
}
- }
-
-
- // debug
- for (size_t i = 0; i < m_phraseDictionaryQueue.size(); ++i) {
- const InputPath &prevPath = *m_phraseDictionaryQueue[i];
- cerr << prevPath << endl;
- }
}
/* forcibly create translation option for a particular source word.