mark a function as legacy

This commit is contained in:
Hieu Hoang 2013-08-07 12:11:39 +01:00
parent 89f39bf89d
commit 24c4c8f210
6 changed files with 25 additions and 15 deletions

View File

@ -103,14 +103,6 @@ public:
const GenerationDictionary* GetGenerationDictionaryFeature() const; const GenerationDictionary* GetGenerationDictionaryFeature() const;
/*! Given an input TranslationOption, extend it in some way (put results in outputPartialTranslOptColl) */
virtual void Process(const TranslationOption &inputPartialTranslOpt
, const DecodeStep &decodeStep
, PartialTranslOptColl &outputPartialTranslOptColl
, TranslationOptionCollection *toc
, bool adhereTableLimit
, const Phrase &src) const = 0;
void RemoveFeature(const FeatureFunction *ff); void RemoveFeature(const FeatureFunction *ff);
}; };

View File

@ -40,7 +40,7 @@ public:
const std::vector<FeatureFunction*> &features); const std::vector<FeatureFunction*> &features);
virtual void Process(const TranslationOption &inputPartialTranslOpt void Process(const TranslationOption &inputPartialTranslOpt
, const DecodeStep &decodeStep , const DecodeStep &decodeStep
, PartialTranslOptColl &outputPartialTranslOptColl , PartialTranslOptColl &outputPartialTranslOptColl
, TranslationOptionCollection *toc , TranslationOptionCollection *toc

View File

@ -44,7 +44,7 @@ DecodeStepTranslation::DecodeStepTranslation(const PhraseDictionary* pdf,
} }
} }
void DecodeStepTranslation::Process(const TranslationOption &inputPartialTranslOpt void DecodeStepTranslation::ProcessLegacy(const TranslationOption &inputPartialTranslOpt
, const DecodeStep &decodeStep , const DecodeStep &decodeStep
, PartialTranslOptColl &outputPartialTranslOptColl , PartialTranslOptColl &outputPartialTranslOptColl
, TranslationOptionCollection *toc , TranslationOptionCollection *toc

View File

@ -42,7 +42,7 @@ public:
const std::vector<FeatureFunction*> &features); const std::vector<FeatureFunction*> &features);
virtual void Process(const TranslationOption &inputPartialTranslOpt void ProcessLegacy(const TranslationOption &inputPartialTranslOpt
, const DecodeStep &decodeStep , const DecodeStep &decodeStep
, PartialTranslOptColl &outputPartialTranslOptColl , PartialTranslOptColl &outputPartialTranslOptColl
, TranslationOptionCollection *toc , TranslationOptionCollection *toc

View File

@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "Util.h" #include "Util.h"
#include "StaticData.h" #include "StaticData.h"
#include "DecodeStepTranslation.h" #include "DecodeStepTranslation.h"
#include "DecodeStepGeneration.h"
#include "DecodeGraph.h" #include "DecodeGraph.h"
#include "moses/FF/UnknownWordPenaltyProducer.h" #include "moses/FF/UnknownWordPenaltyProducer.h"
#include "InputPath.h" #include "InputPath.h"
@ -479,7 +480,9 @@ void TranslationOptionCollection::CreateTranslationOptionsForRange(
, *sourcePhrase , *sourcePhrase
, targetPhrases); , targetPhrases);
} else { } else {
decodeStep->Process(inputPartialTranslOpt const DecodeStepGeneration *genStep = dynamic_cast<const DecodeStepGeneration*>(decodeStep);
assert(genStep);
genStep->Process(inputPartialTranslOpt
, *decodeStep , *decodeStep
, *newPtoc , *newPtoc
, this , this

View File

@ -5,6 +5,7 @@
#include "ConfusionNet.h" #include "ConfusionNet.h"
#include "DecodeStep.h" #include "DecodeStep.h"
#include "DecodeStepTranslation.h" #include "DecodeStepTranslation.h"
#include "DecodeStepGeneration.h"
#include "FactorCollection.h" #include "FactorCollection.h"
#include "FF/InputFeature.h" #include "FF/InputFeature.h"
#include "TranslationModel/PhraseDictionaryTreeAdaptor.h" #include "TranslationModel/PhraseDictionaryTreeAdaptor.h"
@ -210,7 +211,10 @@ void TranslationOptionCollectionConfusionNet::CreateTranslationOptionsForRangeLe
for (++iterStep ; iterStep != decodeGraph.end() ; ++iterStep) { for (++iterStep ; iterStep != decodeGraph.end() ; ++iterStep) {
const DecodeStep &decodeStep = **iterStep; const DecodeStep *decodeStep = *iterStep;
const DecodeStepTranslation *transStep =dynamic_cast<const DecodeStepTranslation*>(decodeStep);
const DecodeStepGeneration *genStep =dynamic_cast<const DecodeStepGeneration*>(decodeStep);
PartialTranslOptColl* newPtoc = new PartialTranslOptColl; PartialTranslOptColl* newPtoc = new PartialTranslOptColl;
// go thru each intermediate trans opt just created // go thru each intermediate trans opt just created
@ -219,12 +223,23 @@ void TranslationOptionCollectionConfusionNet::CreateTranslationOptionsForRangeLe
for (iterPartialTranslOpt = partTransOptList.begin() ; iterPartialTranslOpt != partTransOptList.end() ; ++iterPartialTranslOpt) { for (iterPartialTranslOpt = partTransOptList.begin() ; iterPartialTranslOpt != partTransOptList.end() ; ++iterPartialTranslOpt) {
TranslationOption &inputPartialTranslOpt = **iterPartialTranslOpt; TranslationOption &inputPartialTranslOpt = **iterPartialTranslOpt;
decodeStep.Process(inputPartialTranslOpt if (transStep) {
, decodeStep transStep->ProcessLegacy(inputPartialTranslOpt
, *decodeStep
, *newPtoc , *newPtoc
, this , this
, adhereTableLimit , adhereTableLimit
, *sourcePhrase); , *sourcePhrase);
}
else {
CHECK(genStep);
genStep->Process(inputPartialTranslOpt
, *decodeStep
, *newPtoc
, this
, adhereTableLimit
, *sourcePhrase);
}
} }
// last but 1 partial trans not required anymore // last but 1 partial trans not required anymore