mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
bug in lattice decoding. Some arcs can span more than 1 node
This commit is contained in:
parent
6182750b70
commit
4c74a5d638
@ -37,14 +37,17 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
|
||||
|
||||
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);
|
||||
for (size_t i = 0; i < col.size(); ++i) {
|
||||
const Word &word = col[i].first;
|
||||
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;
|
||||
subphrase.AddWord(word);
|
||||
|
||||
@ -53,9 +56,7 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
|
||||
|
||||
InputPath *path = new InputPath(subphrase, labels, range, NULL, inputScore);
|
||||
|
||||
size_t nextNode = nextNodes[i];
|
||||
path->SetNextNode(nextNode);
|
||||
|
||||
m_inputPathQueue.push_back(path);
|
||||
}
|
||||
}
|
||||
@ -135,7 +136,7 @@ void TranslationOptionCollectionLattice::CreateTranslationOptions()
|
||||
const WordsRange &range = path.GetWordsRange();
|
||||
|
||||
if (tpColl && tpColl->GetSize()) {
|
||||
TargetPhraseCollection::const_iterator iter;
|
||||
TargetPhraseCollection::const_iterator iter;
|
||||
for (iter = tpColl->begin(); iter != tpColl->end(); ++iter) {
|
||||
const TargetPhrase &tp = **iter;
|
||||
TranslationOption *transOpt = new TranslationOption(range, tp);
|
||||
|
Loading…
Reference in New Issue
Block a user