remove description argument from feature function constructor. Redundant

This commit is contained in:
Hieu Hoang 2013-10-29 18:59:53 +00:00
parent bd82b7355b
commit a5f391e3f3
32 changed files with 44 additions and 46 deletions

View File

@ -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),

View File

@ -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();

View File

@ -45,7 +45,7 @@ class ControlRecombination : public StatefulFeatureFunction
{
public:
ControlRecombination(const std::string &line)
:StatefulFeatureFunction("ControlRecombination", 0, line)
:StatefulFeatureFunction(0, line)
,m_type(SameOutput)
{

View File

@ -23,7 +23,7 @@ struct DistortionState_traditional : public FFState {
};
DistortionScoreProducer::DistortionScoreProducer(const std::string &line)
: StatefulFeatureFunction("Distortion", 1, line)
: StatefulFeatureFunction(1, line)
{
ReadParameters();
}

View File

@ -37,7 +37,7 @@ class ExternalFeature : public StatefulFeatureFunction
{
public:
ExternalFeature(const std::string &line)
:StatefulFeatureFunction("ExternalFeature", line) {
:StatefulFeatureFunction(line) {
ReadParameters();
}
~ExternalFeature();

View File

@ -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)

View File

@ -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();

View File

@ -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;

View File

@ -11,7 +11,7 @@ namespace Moses
{
OpSequenceModel::OpSequenceModel(const std::string &line)
:StatefulFeatureFunction("OpSequenceModel", 5, line )
:StatefulFeatureFunction(5, line )
{
sFactor = 0;
tFactor = 0;

View File

@ -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();

View File

@ -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 {

View File

@ -5,14 +5,14 @@ namespace Moses
std::vector<const StatefulFeatureFunction*> 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);
}

View File

@ -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.

View File

@ -6,13 +6,13 @@ namespace Moses
std::vector<const StatelessFeatureFunction*> 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);
}

View File

@ -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();

View File

@ -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();

View File

@ -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();
}

View File

@ -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

View File

@ -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();

View File

@ -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)
{
}

View File

@ -60,7 +60,7 @@ protected:
Word m_sentenceStartWord, m_sentenceEndWord; //! Contains factors which represents the beging and end words for this LM.
//! Usually <s> and </s>
LanguageModelImplementation(const std::string& description, const std::string &line);
LanguageModelImplementation(const std::string &line);
public:

View File

@ -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;
}

View File

@ -140,7 +140,7 @@ private:
} // namespace
template <class Model> LanguageModelKen<Model>::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 <class Model> LanguageModelKen<Model>::LanguageModelKen(const std::stri
}
template <class Model> LanguageModelKen<Model>::LanguageModelKen(const LanguageModelKen<Model> &copy_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),

View File

@ -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:

View File

@ -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
}

View File

@ -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);

View File

@ -85,7 +85,7 @@ private:
public:
LanguageModelParallelBackoff(const std::string &line)
:LanguageModelMultiFactor("ParallelBackoffLM", line) {
:LanguageModelMultiFactor(line) {
}
~LanguageModelParallelBackoff();

View File

@ -44,7 +44,7 @@ namespace Moses
{
LanguageModelRandLM::LanguageModelRandLM(const std::string &line)
:LanguageModelSingleFactor("RandLM", line)
:LanguageModelSingleFactor(line)
, m_lm(0)
{
}

View File

@ -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)
{

View File

@ -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);

View File

@ -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();

View File

@ -7,7 +7,7 @@ using namespace std;
namespace Moses
{
SkeletonLM::SkeletonLM(const std::string &line)
:LanguageModelSingleFactor("SkeletonLM", line)
:LanguageModelSingleFactor(line)
{
ReadParameters();