diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-07-03 22:07:36 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-07-03 22:07:36 +0400 |
commit | 5e355c159584bf7a6f273ec7e79bd7a7e3bcf3b2 (patch) | |
tree | 99e248157b2bb18cc9bde3f393c992c638353775 /moses/TranslationOptionCollectionText.cpp | |
parent | ac8d10af38ba55179fc173538a7b1b0ea6262c38 (diff) |
move lookup of all subphrases into PhraseDictionary class
Diffstat (limited to 'moses/TranslationOptionCollectionText.cpp')
-rw-r--r-- | moses/TranslationOptionCollectionText.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/moses/TranslationOptionCollectionText.cpp b/moses/TranslationOptionCollectionText.cpp index 86d5a3193..c2fccbde1 100644 --- a/moses/TranslationOptionCollectionText.cpp +++ b/moses/TranslationOptionCollectionText.cpp @@ -37,9 +37,11 @@ TranslationOptionCollectionText::TranslationOptionCollectionText(Sentence const { size_t size = input.GetSize(); m_targetPhrasesfromPt.resize(size); - for (size_t startPos = 0; startPos < size; ++startPos) { - std::vector<InputLatticeNode> &vec = m_targetPhrasesfromPt[startPos]; - for (size_t endPos = startPos; endPos < size; ++endPos) { + for (size_t phaseSize = 1; phaseSize <= size; ++phaseSize) { + for (size_t startPos = 0; startPos < size - phaseSize + 1; ++startPos) { + size_t endPos = startPos + phaseSize -1; + std::vector<InputLatticeNode> &vec = m_targetPhrasesfromPt[startPos]; + Phrase subphrase(input.GetSubString(WordsRange(startPos, endPos))); WordsRange range(startPos, endPos); @@ -48,10 +50,11 @@ TranslationOptionCollectionText::TranslationOptionCollectionText(Sentence const vec.push_back(node); } else { - const InputLatticeNode prevNode = GetInputLatticeNode(startPos, endPos - 1); + const InputLatticeNode &prevNode = GetInputLatticeNode(startPos, endPos - 1); InputLatticeNode node(subphrase, range, &prevNode); vec.push_back(node); } + cerr << vec.back() << endl; } } |