diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-10-03 21:58:45 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-10-03 21:58:45 +0400 |
commit | f18e35c42a9d07ca11d5fed107f97999076cfae5 (patch) | |
tree | 2d22fc29d93b75bc4e33854e7f655c1cc2cc882f /moses/TranslationOptionCollectionLattice.cpp | |
parent | a41dbeba46cd9dd0eb0135461464a49e79ac96b5 (diff) |
correct creation of input paths for lattices
Diffstat (limited to 'moses/TranslationOptionCollectionLattice.cpp')
-rw-r--r-- | moses/TranslationOptionCollectionLattice.cpp | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/moses/TranslationOptionCollectionLattice.cpp b/moses/TranslationOptionCollectionLattice.cpp index 63e952e72..99b2626ce 100644 --- a/moses/TranslationOptionCollectionLattice.cpp +++ b/moses/TranslationOptionCollectionLattice.cpp @@ -10,6 +10,8 @@ #include "FactorCollection.h" #include "FF/InputFeature.h" #include "TranslationModel/PhraseDictionaryTreeAdaptor.h" +#include "util/check.hh" +#include "util/exception.hh" using namespace std; @@ -51,20 +53,20 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice( size_t nextNode = nextNodes[i]; path->SetNextNode(nextNode); - m_phraseDictionaryQueue.push_back(path); + m_inputPathQueue.push_back(path); } } - // iterately extend all paths + // iteratively extend all paths for (size_t endPos = 1; endPos < size; ++endPos) { const std::vector<size_t> &nextNodes = input.GetNextNodes(endPos); // loop thru every previous paths - size_t numPrevPaths = m_phraseDictionaryQueue.size(); + size_t numPrevPaths = m_inputPathQueue.size(); for (size_t i = 0; i < numPrevPaths; ++i) { //for (size_t pathInd = 0; pathInd < prevPaths.size(); ++pathInd) { - const InputPath &prevPath = *m_phraseDictionaryQueue[i]; + const InputPath &prevPath = *m_inputPathQueue[i]; size_t nextNode = prevPath.GetNextNode(); if (prevPath.GetWordsRange().GetEndPos() + nextNode != endPos) { @@ -96,13 +98,18 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice( size_t nextNode = nextNodes[i]; path->SetNextNode(nextNode); - m_phraseDictionaryQueue.push_back(path); + m_inputPathQueue.push_back(path); } // for (size_t i = 0; i < col.size(); ++i) { } // for (size_t i = 0; i < numPrevPaths; ++i) { } } +void TranslationOptionCollectionLattice::ProcessUnknownWord() +{ + +} + /* forcibly create translation option for a particular source word. * call the base class' ProcessOneUnknownWord() for each possible word in the confusion network * at a particular source position @@ -114,29 +121,35 @@ void TranslationOptionCollectionLattice::ProcessUnknownWord(size_t sourcePos) void TranslationOptionCollectionLattice::CreateTranslationOptions() { - if (!StaticData::Instance().GetUseLegacyPT()) { - GetTargetPhraseCollectionBatch(); - } - TranslationOptionCollection::CreateTranslationOptions(); -} + GetTargetPhraseCollectionBatch(); + //TranslationOptionCollection::CreateTranslationOptions(); + + VERBOSE(2,"Translation Option Collection\n " << *this << endl); + ProcessUnknownWord(); + + EvaluateWithSource(); + + // Prune + Prune(); + + Sort(); + + // future score matrix + CalcFutureScore(); + + // Cached lex reodering costs + CacheLexReordering(); + +} -/** create translation options that exactly cover a specific input span. - * Called by CreateTranslationOptions() and ProcessUnknownWord() - * \param decodeGraph list of decoding steps - * \param factorCollection input sentence with all factors - * \param startPos first position in input sentence - * \param lastPos last position in input sentence - * \param adhereTableLimit whether phrase & generation table limits are adhered to - */ -void TranslationOptionCollectionLattice::CreateTranslationOptionsForRange( - const DecodeGraph &decodeGraph - , size_t startPos - , size_t endPos - , bool adhereTableLimit - , size_t graphInd) +void TranslationOptionCollectionLattice::CreateTranslationOptionsForRange(const DecodeGraph &decodeStepList + , size_t startPosition + , size_t endPosition + , bool adhereTableLimit + , size_t graphInd) { - //CreateTranslationOptionsForRangeNew(decodeGraph, startPos, endPos, adhereTableLimit, graphInd); + UTIL_THROW(util::Exception, "CreateTranslationOptionsForRange() not implemented for lattice"); } } // namespace |