This commit is contained in:
Ulrich Germann 2014-04-29 15:50:39 +01:00
commit ae4ab9aae0

View File

@ -37,14 +37,17 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
const std::vector<size_t> &nextNodes = input.GetNextNodes(startPos); const std::vector<size_t> &nextNodes = input.GetNextNodes(startPos);
WordsRange range(startPos, startPos);
const NonTerminalSet &labels = input.GetLabelSet(startPos, startPos);
const ConfusionNet::Column &col = input.GetColumn(startPos); const ConfusionNet::Column &col = input.GetColumn(startPos);
for (size_t i = 0; i < col.size(); ++i) { for (size_t i = 0; i < col.size(); ++i) {
const Word &word = col[i].first; const Word &word = col[i].first;
UTIL_THROW_IF2(word.IsEpsilon(), "Epsilon not supported"); UTIL_THROW_IF2(word.IsEpsilon(), "Epsilon not supported");
size_t nextNode = nextNodes[i];
size_t endPos = startPos + nextNode - 1;
WordsRange range(startPos, endPos);
const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);
Phrase subphrase; Phrase subphrase;
subphrase.AddWord(word); subphrase.AddWord(word);
@ -53,9 +56,7 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
InputPath *path = new InputPath(subphrase, labels, range, NULL, inputScore); InputPath *path = new InputPath(subphrase, labels, range, NULL, inputScore);
size_t nextNode = nextNodes[i];
path->SetNextNode(nextNode); path->SetNextNode(nextNode);
m_inputPathQueue.push_back(path); m_inputPathQueue.push_back(path);
} }
} }
@ -135,7 +136,7 @@ void TranslationOptionCollectionLattice::CreateTranslationOptions()
const WordsRange &range = path.GetWordsRange(); const WordsRange &range = path.GetWordsRange();
if (tpColl && tpColl->GetSize()) { if (tpColl && tpColl->GetSize()) {
TargetPhraseCollection::const_iterator iter; TargetPhraseCollection::const_iterator iter;
for (iter = tpColl->begin(); iter != tpColl->end(); ++iter) { for (iter = tpColl->begin(); iter != tpColl->end(); ++iter) {
const TargetPhrase &tp = **iter; const TargetPhrase &tp = **iter;
TranslationOption *transOpt = new TranslationOption(range, tp); TranslationOption *transOpt = new TranslationOption(range, tp);