From a5f391e3f37ed43f627c5f247c92f38eb7a0117f Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Tue, 29 Oct 2013 18:59:53 +0000 Subject: [PATCH] remove description argument from feature function constructor. Redundant --- moses/FF/BleuScoreFeature.cpp | 2 +- moses/FF/ConstrainedDecoding.h | 2 +- moses/FF/ControlRecombination.h | 2 +- moses/FF/DistortionScoreProducer.cpp | 2 +- moses/FF/ExternalFeature.h | 2 +- moses/FF/FeatureFunction.cpp | 6 ++---- moses/FF/FeatureFunction.h | 4 ++-- moses/FF/LexicalReordering/LexicalReordering.cpp | 2 +- moses/FF/OSM-Feature/OpSequenceModel.cpp | 2 +- moses/FF/PhraseBoundaryFeature.cpp | 2 +- moses/FF/SkeletonStatefulFF.h | 2 +- moses/FF/StatefulFeatureFunction.cpp | 8 ++++---- moses/FF/StatefulFeatureFunction.h | 4 ++-- moses/FF/StatelessFeatureFunction.cpp | 4 ++-- moses/FF/TargetBigramFeature.cpp | 2 +- moses/FF/TargetNgramFeature.cpp | 2 +- moses/LM/Base.cpp | 4 ++-- moses/LM/Base.h | 2 +- moses/LM/IRST.cpp | 2 +- moses/LM/Implementation.cpp | 4 ++-- moses/LM/Implementation.h | 2 +- moses/LM/Joint.h | 2 +- moses/LM/Ken.cpp | 4 ++-- moses/LM/MultiFactor.h | 4 ++-- moses/LM/NeuralLMWrapper.cpp | 2 +- moses/LM/ORLM.h | 2 +- moses/LM/ParallelBackoff.cpp | 2 +- moses/LM/Rand.cpp | 2 +- moses/LM/SRI.cpp | 2 +- moses/LM/SingleFactor.cpp | 4 ++-- moses/LM/SingleFactor.h | 2 +- moses/LM/SkeletonLM.cpp | 2 +- 32 files changed, 44 insertions(+), 46 deletions(-) diff --git a/moses/FF/BleuScoreFeature.cpp b/moses/FF/BleuScoreFeature.cpp index 452555855..71620410d 100644 --- a/moses/FF/BleuScoreFeature.cpp +++ b/moses/FF/BleuScoreFeature.cpp @@ -76,7 +76,7 @@ void BleuScoreState::AddNgramCountAndMatches(std::vector< size_t >& counts, BleuScoreFeature::BleuScoreFeature(const std::string &line) - :StatefulFeatureFunction("BleuScoreFeature",1, line), + :StatefulFeatureFunction(1, line), m_enabled(true), m_sentence_bleu(true), m_simple_history_bleu(false), diff --git a/moses/FF/ConstrainedDecoding.h b/moses/FF/ConstrainedDecoding.h index 6d382abc9..f7228a86d 100644 --- a/moses/FF/ConstrainedDecoding.h +++ b/moses/FF/ConstrainedDecoding.h @@ -34,7 +34,7 @@ class ConstrainedDecoding : public StatefulFeatureFunction { public: ConstrainedDecoding(const std::string &line) - :StatefulFeatureFunction("ConstrainedDecoding", 1, line) + :StatefulFeatureFunction(1, line) ,m_maxUnknowns(0) { m_tuneable = false; ReadParameters(); diff --git a/moses/FF/ControlRecombination.h b/moses/FF/ControlRecombination.h index 2ac4aa8e3..3d1d0d987 100644 --- a/moses/FF/ControlRecombination.h +++ b/moses/FF/ControlRecombination.h @@ -45,7 +45,7 @@ class ControlRecombination : public StatefulFeatureFunction { public: ControlRecombination(const std::string &line) - :StatefulFeatureFunction("ControlRecombination", 0, line) + :StatefulFeatureFunction(0, line) ,m_type(SameOutput) { diff --git a/moses/FF/DistortionScoreProducer.cpp b/moses/FF/DistortionScoreProducer.cpp index 54fb8ae95..303f35236 100644 --- a/moses/FF/DistortionScoreProducer.cpp +++ b/moses/FF/DistortionScoreProducer.cpp @@ -23,7 +23,7 @@ struct DistortionState_traditional : public FFState { }; DistortionScoreProducer::DistortionScoreProducer(const std::string &line) - : StatefulFeatureFunction("Distortion", 1, line) + : StatefulFeatureFunction(1, line) { ReadParameters(); } diff --git a/moses/FF/ExternalFeature.h b/moses/FF/ExternalFeature.h index 04414f0a8..f199ca99f 100644 --- a/moses/FF/ExternalFeature.h +++ b/moses/FF/ExternalFeature.h @@ -37,7 +37,7 @@ class ExternalFeature : public StatefulFeatureFunction { public: ExternalFeature(const std::string &line) - :StatefulFeatureFunction("ExternalFeature", line) { + :StatefulFeatureFunction(line) { ReadParameters(); } ~ExternalFeature(); diff --git a/moses/FF/FeatureFunction.cpp b/moses/FF/FeatureFunction.cpp index 4fc8dbd90..8dede9866 100644 --- a/moses/FF/FeatureFunction.cpp +++ b/moses/FF/FeatureFunction.cpp @@ -30,8 +30,7 @@ FeatureFunction &FeatureFunction::FindFeatureFunction(const std::string& name) } FeatureFunction:: -FeatureFunction(const std::string& description, - const std::string& line) +FeatureFunction(const std::string& line) : m_tuneable(true) , m_numScoreComponents(1) { @@ -39,8 +38,7 @@ FeatureFunction(const std::string& description, } FeatureFunction:: -FeatureFunction(const std::string& description, - size_t numScoreComponents, +FeatureFunction(size_t numScoreComponents, const std::string& line) : m_tuneable(true) , m_numScoreComponents(numScoreComponents) diff --git a/moses/FF/FeatureFunction.h b/moses/FF/FeatureFunction.h index 09c189774..98a637223 100644 --- a/moses/FF/FeatureFunction.h +++ b/moses/FF/FeatureFunction.h @@ -45,8 +45,8 @@ public: } static FeatureFunction &FindFeatureFunction(const std::string& name); - FeatureFunction(const std::string& description, const std::string &line); - FeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line); + FeatureFunction(const std::string &line); + FeatureFunction(size_t numScoreComponents, const std::string &line); virtual bool IsStateless() const = 0; virtual ~FeatureFunction(); diff --git a/moses/FF/LexicalReordering/LexicalReordering.cpp b/moses/FF/LexicalReordering/LexicalReordering.cpp index 2486714a5..c73c0324b 100644 --- a/moses/FF/LexicalReordering/LexicalReordering.cpp +++ b/moses/FF/LexicalReordering/LexicalReordering.cpp @@ -10,7 +10,7 @@ using namespace std; namespace Moses { LexicalReordering::LexicalReordering(const std::string &line) - : StatefulFeatureFunction("LexicalReordering", line) + : StatefulFeatureFunction(line) { std::cerr << "Initializing LexicalReordering.." << std::endl; diff --git a/moses/FF/OSM-Feature/OpSequenceModel.cpp b/moses/FF/OSM-Feature/OpSequenceModel.cpp index e35e31a33..553196270 100644 --- a/moses/FF/OSM-Feature/OpSequenceModel.cpp +++ b/moses/FF/OSM-Feature/OpSequenceModel.cpp @@ -11,7 +11,7 @@ namespace Moses { OpSequenceModel::OpSequenceModel(const std::string &line) - :StatefulFeatureFunction("OpSequenceModel", 5, line ) + :StatefulFeatureFunction(5, line ) { sFactor = 0; tFactor = 0; diff --git a/moses/FF/PhraseBoundaryFeature.cpp b/moses/FF/PhraseBoundaryFeature.cpp index a398fdc6a..d82181b76 100644 --- a/moses/FF/PhraseBoundaryFeature.cpp +++ b/moses/FF/PhraseBoundaryFeature.cpp @@ -18,7 +18,7 @@ int PhraseBoundaryState::Compare(const FFState& other) const } PhraseBoundaryFeature::PhraseBoundaryFeature(const std::string &line) - : StatefulFeatureFunction("PhraseBoundaryFeature", 0, line) + : StatefulFeatureFunction(0, line) { std::cerr << "Initializing source word deletion feature.." << std::endl; ReadParameters(); diff --git a/moses/FF/SkeletonStatefulFF.h b/moses/FF/SkeletonStatefulFF.h index c3bb10e37..5b0ca0f95 100644 --- a/moses/FF/SkeletonStatefulFF.h +++ b/moses/FF/SkeletonStatefulFF.h @@ -22,7 +22,7 @@ class SkeletonStatefulFF : public StatefulFeatureFunction { public: SkeletonStatefulFF(const std::string &line) - :StatefulFeatureFunction("SkeletonStatefulFF", 3, line) + :StatefulFeatureFunction(3, line) {} bool IsUseable(const FactorMask &mask) const { diff --git a/moses/FF/StatefulFeatureFunction.cpp b/moses/FF/StatefulFeatureFunction.cpp index 37b9c2dee..9e61ed05f 100644 --- a/moses/FF/StatefulFeatureFunction.cpp +++ b/moses/FF/StatefulFeatureFunction.cpp @@ -5,14 +5,14 @@ namespace Moses std::vector StatefulFeatureFunction::m_statefulFFs; -StatefulFeatureFunction::StatefulFeatureFunction(const std::string& description, const std::string &line) - : FeatureFunction(description, line) +StatefulFeatureFunction::StatefulFeatureFunction(const std::string &line) + : FeatureFunction(line) { m_statefulFFs.push_back(this); } -StatefulFeatureFunction::StatefulFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line) - : FeatureFunction(description,numScoreComponents, line) +StatefulFeatureFunction::StatefulFeatureFunction(size_t numScoreComponents, const std::string &line) + : FeatureFunction(numScoreComponents, line) { m_statefulFFs.push_back(this); } diff --git a/moses/FF/StatefulFeatureFunction.h b/moses/FF/StatefulFeatureFunction.h index e99355ba2..75b46d827 100644 --- a/moses/FF/StatefulFeatureFunction.h +++ b/moses/FF/StatefulFeatureFunction.h @@ -19,8 +19,8 @@ public: return m_statefulFFs; } - StatefulFeatureFunction(const std::string& description, const std::string &line); - StatefulFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line); + StatefulFeatureFunction(const std::string &line); + StatefulFeatureFunction(size_t numScoreComponents, const std::string &line); /** * \brief This interface should be implemented. diff --git a/moses/FF/StatelessFeatureFunction.cpp b/moses/FF/StatelessFeatureFunction.cpp index 0ee5d221b..ecad23e6f 100644 --- a/moses/FF/StatelessFeatureFunction.cpp +++ b/moses/FF/StatelessFeatureFunction.cpp @@ -6,13 +6,13 @@ namespace Moses std::vector StatelessFeatureFunction::m_statelessFFs; StatelessFeatureFunction::StatelessFeatureFunction(const std::string &line) - :FeatureFunction("", line) + :FeatureFunction(line) { m_statelessFFs.push_back(this); } StatelessFeatureFunction::StatelessFeatureFunction(size_t numScoreComponents, const std::string &line) - :FeatureFunction("", numScoreComponents, line) + :FeatureFunction(numScoreComponents, line) { m_statelessFFs.push_back(this); } diff --git a/moses/FF/TargetBigramFeature.cpp b/moses/FF/TargetBigramFeature.cpp index 083e16ac0..337e47050 100644 --- a/moses/FF/TargetBigramFeature.cpp +++ b/moses/FF/TargetBigramFeature.cpp @@ -18,7 +18,7 @@ int TargetBigramState::Compare(const FFState& other) const } TargetBigramFeature::TargetBigramFeature(const std::string &line) - :StatefulFeatureFunction("TargetBigramFeature", 0, line) + :StatefulFeatureFunction(0, line) { std::cerr << "Initializing target bigram feature.." << std::endl; ReadParameters(); diff --git a/moses/FF/TargetNgramFeature.cpp b/moses/FF/TargetNgramFeature.cpp index 8dc934ffd..a14082266 100644 --- a/moses/FF/TargetNgramFeature.cpp +++ b/moses/FF/TargetNgramFeature.cpp @@ -38,7 +38,7 @@ int TargetNgramState::Compare(const FFState& other) const } TargetNgramFeature::TargetNgramFeature(const std::string &line) - :StatefulFeatureFunction("TargetNgramFeature", 0, line) + :StatefulFeatureFunction(0, line) { std::cerr << "Initializing target ngram feature.." << std::endl; ReadParameters(); diff --git a/moses/LM/Base.cpp b/moses/LM/Base.cpp index b77d64fef..f59b5e31b 100644 --- a/moses/LM/Base.cpp +++ b/moses/LM/Base.cpp @@ -34,8 +34,8 @@ using namespace std; namespace Moses { -LanguageModel::LanguageModel(const std::string& description, const std::string &line) : - StatefulFeatureFunction(description, StaticData::Instance().GetLMEnableOOVFeature() ? 2 : 1, line ) +LanguageModel::LanguageModel(const std::string &line) : + StatefulFeatureFunction(StaticData::Instance().GetLMEnableOOVFeature() ? 2 : 1, line ) { m_enableOOVFeature = StaticData::Instance().GetLMEnableOOVFeature(); } diff --git a/moses/LM/Base.h b/moses/LM/Base.h index 5c9616e46..fb24ba627 100644 --- a/moses/LM/Base.h +++ b/moses/LM/Base.h @@ -43,7 +43,7 @@ class Phrase; class LanguageModel : public StatefulFeatureFunction { protected: - LanguageModel(const std::string& description, const std::string &line); + LanguageModel(const std::string &line); // This can't be in the constructor for virual function dispatch reasons diff --git a/moses/LM/IRST.cpp b/moses/LM/IRST.cpp index bde78e1b8..44c5d8c4c 100644 --- a/moses/LM/IRST.cpp +++ b/moses/LM/IRST.cpp @@ -40,7 +40,7 @@ using namespace std; namespace Moses { LanguageModelIRST::LanguageModelIRST(const std::string &line) - :LanguageModelSingleFactor("IRSTLM", line) + :LanguageModelSingleFactor(line) { const StaticData &staticData = StaticData::Instance(); int threadCount = staticData.ThreadCount(); diff --git a/moses/LM/Implementation.cpp b/moses/LM/Implementation.cpp index 3f94fece8..267b94dd6 100644 --- a/moses/LM/Implementation.cpp +++ b/moses/LM/Implementation.cpp @@ -41,8 +41,8 @@ using namespace std; namespace Moses { -LanguageModelImplementation::LanguageModelImplementation(const std::string& description, const std::string &line) - :LanguageModel(description, line) +LanguageModelImplementation::LanguageModelImplementation(const std::string &line) + :LanguageModel(line) { } diff --git a/moses/LM/Implementation.h b/moses/LM/Implementation.h index e6a230ad8..a39f5e42b 100644 --- a/moses/LM/Implementation.h +++ b/moses/LM/Implementation.h @@ -60,7 +60,7 @@ protected: Word m_sentenceStartWord, m_sentenceEndWord; //! Contains factors which represents the beging and end words for this LM. //! Usually and - LanguageModelImplementation(const std::string& description, const std::string &line); + LanguageModelImplementation(const std::string &line); public: diff --git a/moses/LM/Joint.h b/moses/LM/Joint.h index e94c29b4f..1dbdb019e 100644 --- a/moses/LM/Joint.h +++ b/moses/LM/Joint.h @@ -50,7 +50,7 @@ protected: size_t m_implFactor; public: LanguageModelJoint(const std::string &line, LanguageModelSingleFactor *lmImpl) - :LanguageModelMultiFactor("JointLM", line) { + :LanguageModelMultiFactor(line) { m_lmImpl = lmImpl; } diff --git a/moses/LM/Ken.cpp b/moses/LM/Ken.cpp index ed0278029..2bb6a16f9 100644 --- a/moses/LM/Ken.cpp +++ b/moses/LM/Ken.cpp @@ -140,7 +140,7 @@ private: } // namespace template LanguageModelKen::LanguageModelKen(const std::string &line, const std::string &file, FactorType factorType, bool lazy) - :LanguageModel("KENLM", line) + :LanguageModel(line) ,m_factorType(factorType) { lm::ngram::Config config; @@ -161,7 +161,7 @@ template LanguageModelKen::LanguageModelKen(const std::stri } template LanguageModelKen::LanguageModelKen(const LanguageModelKen ©_from) - :LanguageModel(copy_from.GetScoreProducerDescription(), copy_from.GetArgLine()), + :LanguageModel(copy_from.GetArgLine()), m_ngram(copy_from.m_ngram), // TODO: don't copy this. m_lmIdLookup(copy_from.m_lmIdLookup), diff --git a/moses/LM/MultiFactor.h b/moses/LM/MultiFactor.h index 619ad94f3..df476f93f 100644 --- a/moses/LM/MultiFactor.h +++ b/moses/LM/MultiFactor.h @@ -41,8 +41,8 @@ class LanguageModelMultiFactor : public LanguageModelImplementation protected: FactorMask m_factorTypes; - LanguageModelMultiFactor(const std::string& description, const std::string &line) - :LanguageModelImplementation(description, line) { + LanguageModelMultiFactor(const std::string &line) + :LanguageModelImplementation(line) { } public: diff --git a/moses/LM/NeuralLMWrapper.cpp b/moses/LM/NeuralLMWrapper.cpp index 41ceded9d..467c41846 100644 --- a/moses/LM/NeuralLMWrapper.cpp +++ b/moses/LM/NeuralLMWrapper.cpp @@ -10,7 +10,7 @@ using namespace std; namespace Moses { NeuralLMWrapper::NeuralLMWrapper(const std::string &line) -:LanguageModelSingleFactor("NeuralLM", line) +:LanguageModelSingleFactor(line) { // This space intentionally left blank } diff --git a/moses/LM/ORLM.h b/moses/LM/ORLM.h index 4443b4732..dd2a675d8 100644 --- a/moses/LM/ORLM.h +++ b/moses/LM/ORLM.h @@ -22,7 +22,7 @@ class LanguageModelORLM : public LanguageModelSingleFactor public: typedef count_t T; // type for ORLM filter LanguageModelORLM(const std::string &line) - :LanguageModelSingleFactor("ORLM", line) + :LanguageModelSingleFactor(line) ,m_lm(0) { } bool Load(const std::string &filePath, FactorType factorType, size_t nGramOrder); diff --git a/moses/LM/ParallelBackoff.cpp b/moses/LM/ParallelBackoff.cpp index 3d67e9c90..063e9c818 100644 --- a/moses/LM/ParallelBackoff.cpp +++ b/moses/LM/ParallelBackoff.cpp @@ -85,7 +85,7 @@ private: public: LanguageModelParallelBackoff(const std::string &line) - :LanguageModelMultiFactor("ParallelBackoffLM", line) { + :LanguageModelMultiFactor(line) { } ~LanguageModelParallelBackoff(); diff --git a/moses/LM/Rand.cpp b/moses/LM/Rand.cpp index 0f11fea07..67c335dab 100644 --- a/moses/LM/Rand.cpp +++ b/moses/LM/Rand.cpp @@ -44,7 +44,7 @@ namespace Moses { LanguageModelRandLM::LanguageModelRandLM(const std::string &line) - :LanguageModelSingleFactor("RandLM", line) + :LanguageModelSingleFactor(line) , m_lm(0) { } diff --git a/moses/LM/SRI.cpp b/moses/LM/SRI.cpp index 6182bd22c..708374668 100644 --- a/moses/LM/SRI.cpp +++ b/moses/LM/SRI.cpp @@ -54,7 +54,7 @@ using namespace std; namespace Moses { LanguageModelSRI::LanguageModelSRI(const std::string &line) - :LanguageModelSingleFactor("SRILM", line) + :LanguageModelSingleFactor(line) ,m_srilmVocab(0) ,m_srilmModel(0) { diff --git a/moses/LM/SingleFactor.cpp b/moses/LM/SingleFactor.cpp index 04f410c98..d2c0f990a 100644 --- a/moses/LM/SingleFactor.cpp +++ b/moses/LM/SingleFactor.cpp @@ -38,8 +38,8 @@ using namespace std; namespace Moses { -LanguageModelSingleFactor::LanguageModelSingleFactor(const std::string& description, const std::string &line) - :LanguageModelImplementation(description, line) +LanguageModelSingleFactor::LanguageModelSingleFactor(const std::string &line) + :LanguageModelImplementation(line) { m_nullContextState = new PointerState(NULL); m_beginSentenceState = new PointerState(NULL); diff --git a/moses/LM/SingleFactor.h b/moses/LM/SingleFactor.h index af0edd4c6..eeb5cdbef 100644 --- a/moses/LM/SingleFactor.h +++ b/moses/LM/SingleFactor.h @@ -43,7 +43,7 @@ protected: FFState *m_nullContextState; FFState *m_beginSentenceState; - LanguageModelSingleFactor(const std::string& description, const std::string &line); + LanguageModelSingleFactor(const std::string &line); public: virtual ~LanguageModelSingleFactor(); diff --git a/moses/LM/SkeletonLM.cpp b/moses/LM/SkeletonLM.cpp index 6bf47e108..6c11512fe 100644 --- a/moses/LM/SkeletonLM.cpp +++ b/moses/LM/SkeletonLM.cpp @@ -7,7 +7,7 @@ using namespace std; namespace Moses { SkeletonLM::SkeletonLM(const std::string &line) - :LanguageModelSingleFactor("SkeletonLM", line) + :LanguageModelSingleFactor(line) { ReadParameters();