diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2020-10-04 21:39:56 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2020-10-04 21:39:56 +0300 |
commit | 083b6bf560afb959640ed7c37562e964cf0ae1fd (patch) | |
tree | 48dd45f7f39f1ead744acf7c7a688412a9e41918 /moses2 | |
parent | 1990ac88d4538b513cae0a2486152f283b503577 (diff) |
add system
Diffstat (limited to 'moses2')
-rw-r--r-- | moses2/FF/FeatureFunction.h | 4 | ||||
-rw-r--r-- | moses2/FF/FeatureFunctions.cpp | 4 | ||||
-rw-r--r-- | moses2/TranslationModel/MSPT/MSPT.cpp | 11 | ||||
-rw-r--r-- | moses2/TranslationModel/MSPT/MSPT.h | 2 |
4 files changed, 12 insertions, 9 deletions
diff --git a/moses2/FF/FeatureFunction.h b/moses2/FF/FeatureFunction.h index 34742efb1..828a712b9 100644 --- a/moses2/FF/FeatureFunction.h +++ b/moses2/FF/FeatureFunction.h @@ -96,10 +96,10 @@ public: const SCFG::TargetPhrases &tps, const Phrase<SCFG::Word> &sourcePhrase) const { } - virtual void InitializeForInput(const InputType &input) { }; + virtual void InitializeForInput(const System &system, const InputType &input) { }; // clean up temporary memory, called after processing each sentence - virtual void CleanUpAfterSentenceProcessing(const InputType &input) const { + virtual void CleanUpAfterSentenceProcessing(const System &system, const InputType &input) const { } protected: diff --git a/moses2/FF/FeatureFunctions.cpp b/moses2/FF/FeatureFunctions.cpp index efe018b7b..39e2436b6 100644 --- a/moses2/FF/FeatureFunctions.cpp +++ b/moses2/FF/FeatureFunctions.cpp @@ -232,14 +232,14 @@ void FeatureFunctions::EvaluateWhenAppliedBatch(const Batch &batch) const void FeatureFunctions::InitializeForInput(const InputType &input) { BOOST_FOREACH(FeatureFunction *ff, m_featureFunctions) { - ff->InitializeForInput(input); + ff->InitializeForInput(m_system, input); } } void FeatureFunctions::CleanUpAfterSentenceProcessing(const InputType &input) const { BOOST_FOREACH(const FeatureFunction *ff, m_featureFunctions) { - ff->CleanUpAfterSentenceProcessing(input); + ff->CleanUpAfterSentenceProcessing(m_system, input); } } diff --git a/moses2/TranslationModel/MSPT/MSPT.cpp b/moses2/TranslationModel/MSPT/MSPT.cpp index 17dea92a0..8d33071f6 100644 --- a/moses2/TranslationModel/MSPT/MSPT.cpp +++ b/moses2/TranslationModel/MSPT/MSPT.cpp @@ -28,6 +28,7 @@ #include "../../SCFG/Stacks.h" #include "../../SCFG/Manager.h" +#include "../../PhraseBased/SentenceWithCandidates.h" using namespace std; @@ -152,14 +153,16 @@ MSPT::~MSPT() // } -void MSPT::InitializeForInput(const InputType &input) +void MSPT::InitializeForInput(const System &system, const InputType &input) { cerr << "InitializeForInput MSPT" << endl; + cerr << &input << endl; // downcast to SentenceWithCandidates - const SentenceWithCandidates& inputObj = dynamic_cast<const SentenceWithCandidates&>(input); - cerr << "Casting done." << endl; - // cerr << "PhraseTableString member: " << inputObj.getPhraseTableString() << endl; + //const SentenceWithCandidates *inputObj = static_cast<const SentenceWithCandidates*>(&input); + const SentenceWithCandidates* inputObj = dynamic_cast<const SentenceWithCandidates*>(&input); + cerr << "Casting done." << endl << flush; + cerr << "PhraseTableString member: " << inputObj->getPhraseTableString() << endl; } diff --git a/moses2/TranslationModel/MSPT/MSPT.h b/moses2/TranslationModel/MSPT/MSPT.h index 165565791..b3ff99c91 100644 --- a/moses2/TranslationModel/MSPT/MSPT.h +++ b/moses2/TranslationModel/MSPT/MSPT.h @@ -65,7 +65,7 @@ public: const SCFG::Stacks &stacks, SCFG::InputPath &path) const; - virtual void InitializeForInput(const InputType &input); + virtual void InitializeForInput(const System &system, const InputType &input); protected: PBNODE *m_rootPb; |