get rid of int argument from GetScoreProducerWeightShortName()

This commit is contained in:
Hieu Hoang 2012-12-04 13:08:00 +00:00
parent 55f65c3104
commit 33105a7ba7
34 changed files with 54 additions and 62 deletions

View File

@ -456,7 +456,7 @@ void WriteFeatures(const TranslationSystem &system, const ScoreComponentCollecti
for (size_t j = 0; j<scores.size(); ++j){
if (labeledOutput && (i == 0) ){
if ((j == 0) || (j == pd_numinputscore)){
lastName = pds[i]->GetScoreProducerWeightShortName(j);
lastName = pds[i]->GetScoreProducerWeightShortName();
out << " " << lastName << ":";
}
}
@ -479,7 +479,7 @@ void WriteFeatures(const TranslationSystem &system, const ScoreComponentCollecti
for (size_t j = 0; j<scores.size(); ++j){
if (labeledOutput && (i == 0) ){
if ((j == 0) || (j == pd_numinputscore)){
lastName = gds[i]->GetScoreProducerWeightShortName(j);
lastName = gds[i]->GetScoreProducerWeightShortName();
out << " " << lastName << ":";
}
}

View File

@ -400,7 +400,7 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con
if (labeledOutput && (i == 0) ){
if ((j == 0) || (j == pd_numinputscore)){
lastName = pds[i]->GetScoreProducerWeightShortName(j);
lastName = pds[i]->GetScoreProducerWeightShortName();
out << " " << lastName << ":";
}
}
@ -420,7 +420,7 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con
if (labeledOutput && (i == 0) ){
if ((j == 0) || (j == pd_numinputscore)){
lastName = gds[i]->GetScoreProducerWeightShortName(j);
lastName = gds[i]->GetScoreProducerWeightShortName();
out << " " << lastName << ":";
}
}

View File

@ -85,7 +85,7 @@ public:
return "BleuScoreFeature";
}
std::string GetScoreProducerWeightShortName(unsigned) const
std::string GetScoreProducerWeightShortName() const
{
return "bl";
}

View File

@ -39,7 +39,7 @@ const FFState* DistortionScoreProducer::EmptyHypothesisState(const InputType &in
}
std::string DistortionScoreProducer::GetScoreProducerWeightShortName(unsigned) const
std::string DistortionScoreProducer::GetScoreProducerWeightShortName() const
{
return "d";
}
@ -108,7 +108,7 @@ FFState* DistortionScoreProducer::Evaluate(
}
std::string WordPenaltyProducer::GetScoreProducerWeightShortName(unsigned) const
std::string WordPenaltyProducer::GetScoreProducerWeightShortName() const
{
return "w";
}
@ -121,7 +121,7 @@ void WordPenaltyProducer::Evaluate(
out->PlusEquals(this, -static_cast<float>(tp.GetSize()));
}
std::string UnknownWordPenaltyProducer::GetScoreProducerWeightShortName(unsigned) const
std::string UnknownWordPenaltyProducer::GetScoreProducerWeightShortName() const
{
return "u";
}
@ -132,7 +132,7 @@ bool UnknownWordPenaltyProducer::ComputeValueInTranslationOption() const
return true;
}
std::string MetaFeatureProducer::GetScoreProducerWeightShortName(unsigned) const
std::string MetaFeatureProducer::GetScoreProducerWeightShortName() const
{
return "m"+m_shortName;
}

View File

@ -20,7 +20,7 @@ public:
float CalculateDistortionScore(const Hypothesis& hypo,
const WordsRange &prev, const WordsRange &curr, const int FirstGapPosition) const;
std::string GetScoreProducerWeightShortName(unsigned) const;
std::string GetScoreProducerWeightShortName() const;
virtual const FFState* EmptyHypothesisState(const InputType &input) const;
virtual FFState* Evaluate(
@ -45,7 +45,7 @@ class WordPenaltyProducer : public StatelessFeatureFunction
public:
WordPenaltyProducer() : StatelessFeatureFunction("WordPenalty",1) {}
std::string GetScoreProducerWeightShortName(unsigned) const;
std::string GetScoreProducerWeightShortName() const;
virtual void Evaluate(
const PhraseBasedFeatureContext& context,
@ -68,7 +68,7 @@ class UnknownWordPenaltyProducer : public StatelessFeatureFunction
public:
UnknownWordPenaltyProducer() : StatelessFeatureFunction("!UnknownWordPenalty",1) {}
std::string GetScoreProducerWeightShortName(unsigned) const;
std::string GetScoreProducerWeightShortName() const;
virtual bool ComputeValueInTranslationOption() const;
void Evaluate( const PhraseBasedFeatureContext& context,
@ -95,7 +95,7 @@ class MetaFeatureProducer : public StatelessFeatureFunction
std::string m_shortName;
std::string GetScoreProducerWeightShortName(unsigned) const;
std::string GetScoreProducerWeightShortName() const;
void Evaluate(const PhraseBasedFeatureContext& context,
ScoreComponentCollection* accumulator) const {

View File

@ -71,7 +71,7 @@ public:
//! load data file
bool Load(const std::string &filePath, FactorDirection direction);
std::string GetScoreProducerWeightShortName(unsigned) const
std::string GetScoreProducerWeightShortName() const
{
return "g";
}

View File

@ -68,7 +68,7 @@ public:
const std::vector< FactorType >& outFactors);
virtual ~GlobalLexicalModel();
virtual std::string GetScoreProducerWeightShortName(unsigned) const {
virtual std::string GetScoreProducerWeightShortName() const {
return "lex";
};

View File

@ -109,7 +109,7 @@ public:
std::cerr << "done." << std::endl;
}
std::string GetScoreProducerWeightShortName(unsigned) const {
std::string GetScoreProducerWeightShortName() const {
return "glm";
};

View File

@ -58,7 +58,7 @@ public:
float GetWeight() const;
float GetOOVWeight() const;
std::string GetScoreProducerWeightShortName(unsigned) const {
std::string GetScoreProducerWeightShortName() const {
return "lm";
}

View File

@ -115,7 +115,7 @@ public:
}
std::string GetScoreProducerWeightShortName(unsigned) const {
std::string GetScoreProducerWeightShortName() const {
return "lm";
}

View File

@ -40,7 +40,7 @@ public:
virtual const FFState* EmptyHypothesisState(const InputType &input) const;
std::string GetScoreProducerWeightShortName(unsigned) const {
std::string GetScoreProducerWeightShortName() const {
return "d";
};

View File

@ -22,7 +22,7 @@ PhraseBoundaryFeature::PhraseBoundaryFeature
{
}
string PhraseBoundaryFeature::GetScoreProducerWeightShortName(unsigned) const
string PhraseBoundaryFeature::GetScoreProducerWeightShortName() const
{
return "pb";
}

View File

@ -34,7 +34,7 @@ public:
PhraseBoundaryFeature(const FactorList& sourceFactors, const FactorList& targetFactors);
size_t GetNumScoreComponents() const;
std::string GetScoreProducerWeightShortName(unsigned) const;
std::string GetScoreProducerWeightShortName() const;
size_t GetNumInputScores() const;
virtual const FFState* EmptyHypothesisState(const InputType &) const;

View File

@ -30,7 +30,7 @@ public:
}
// basic properties
std::string GetScoreProducerWeightShortName(unsigned) const { return "pl"; }
std::string GetScoreProducerWeightShortName() const { return "pl"; }
size_t GetNumInputScores() const { return 0; }
};

View File

@ -11,7 +11,7 @@ using namespace std;
namespace Moses {
string PhrasePairFeature::GetScoreProducerWeightShortName(unsigned) const
string PhrasePairFeature::GetScoreProducerWeightShortName() const
{
return "pp";
}

View File

@ -66,7 +66,7 @@ class PhrasePairFeature: public StatelessFeatureFunction {
bool ComputeValueInTranslationOption() const;
std::string GetScoreProducerWeightShortName(unsigned) const;
std::string GetScoreProducerWeightShortName() const;
size_t GetNumInputScores() const;
bool Load(const std::string &filePathSource/*, const std::string &filePathTarget*/);

View File

@ -41,19 +41,19 @@ class MockStatelessFeatureFunction : public StatelessFeatureFunction {
class MockSingleFeature : public MockStatelessFeatureFunction {
public:
MockSingleFeature(): MockStatelessFeatureFunction("MockSingle",1) {}
std::string GetScoreProducerWeightShortName(unsigned) const {return "sf";}
std::string GetScoreProducerWeightShortName() const {return "sf";}
};
class MockMultiFeature : public MockStatelessFeatureFunction {
public:
MockMultiFeature(): MockStatelessFeatureFunction("MockMulti", 5) {}
std::string GetScoreProducerWeightShortName(unsigned) const {return "mf";}
std::string GetScoreProducerWeightShortName() const {return "mf";}
};
class MockSparseFeature : public MockStatelessFeatureFunction {
public:
MockSparseFeature(): MockStatelessFeatureFunction("MockSparse", ScoreProducer::unlimited) {}
std::string GetScoreProducerWeightShortName(unsigned) const {return "sf";}
std::string GetScoreProducerWeightShortName() const {return "sf";}
};

View File

@ -47,7 +47,7 @@ public:
const std::string& GetScoreProducerDescription() const {return m_description;}
//! returns the weight parameter name of this producer (used in n-best list)
virtual std::string GetScoreProducerWeightShortName(unsigned idx=0) const = 0;
virtual std::string GetScoreProducerWeightShortName() const = 0;
//! returns the number of scores gathered from the input (0 by default)
virtual size_t GetNumInputScores() const {

View File

@ -40,7 +40,7 @@ public:
const AlignmentInfo &alignmentInfo) const;
// basic properties
std::string GetScoreProducerWeightShortName(unsigned) const { return "swd"; }
std::string GetScoreProducerWeightShortName() const { return "swd"; }
size_t GetNumInputScores() const { return 0; }
};

View File

@ -28,7 +28,7 @@ public:
}
// basic properties
std::string GetScoreProducerWeightShortName(unsigned) const { return "stm"; }
std::string GetScoreProducerWeightShortName() const { return "stm"; }
size_t GetNumInputScores() const { return 0; }
};

View File

@ -560,30 +560,30 @@ bool StaticData::LoadData(Parameter *parameter)
if (m_parameter->GetParam("report-sparse-features").size() > 0) {
for(size_t i=0; i<m_parameter->GetParam("report-sparse-features").size(); i++) {
const std::string &name = m_parameter->GetParam("report-sparse-features")[i];
if (m_targetBigramFeature && name.compare(m_targetBigramFeature->GetScoreProducerWeightShortName(0)) == 0)
if (m_targetBigramFeature && name.compare(m_targetBigramFeature->GetScoreProducerWeightShortName()) == 0)
m_targetBigramFeature->SetSparseFeatureReporting();
if (m_targetNgramFeatures.size() > 0)
for (size_t i=0; i < m_targetNgramFeatures.size(); ++i)
if (name.compare(m_targetNgramFeatures[i]->GetScoreProducerWeightShortName(0)) == 0)
if (name.compare(m_targetNgramFeatures[i]->GetScoreProducerWeightShortName()) == 0)
m_targetNgramFeatures[i]->SetSparseFeatureReporting();
if (m_phraseBoundaryFeature && name.compare(m_phraseBoundaryFeature->GetScoreProducerWeightShortName(0)) == 0)
if (m_phraseBoundaryFeature && name.compare(m_phraseBoundaryFeature->GetScoreProducerWeightShortName()) == 0)
m_phraseBoundaryFeature->SetSparseFeatureReporting();
if (m_phraseLengthFeature && name.compare(m_phraseLengthFeature->GetScoreProducerWeightShortName(0)) == 0)
if (m_phraseLengthFeature && name.compare(m_phraseLengthFeature->GetScoreProducerWeightShortName()) == 0)
m_phraseLengthFeature->SetSparseFeatureReporting();
if (m_targetWordInsertionFeature && name.compare(m_targetWordInsertionFeature->GetScoreProducerWeightShortName(0)) == 0)
if (m_targetWordInsertionFeature && name.compare(m_targetWordInsertionFeature->GetScoreProducerWeightShortName()) == 0)
m_targetWordInsertionFeature->SetSparseFeatureReporting();
if (m_sourceWordDeletionFeature && name.compare(m_sourceWordDeletionFeature->GetScoreProducerWeightShortName(0)) == 0)
if (m_sourceWordDeletionFeature && name.compare(m_sourceWordDeletionFeature->GetScoreProducerWeightShortName()) == 0)
m_sourceWordDeletionFeature->SetSparseFeatureReporting();
if (m_wordTranslationFeatures.size() > 0)
for (size_t i=0; i < m_wordTranslationFeatures.size(); ++i)
if (name.compare(m_wordTranslationFeatures[i]->GetScoreProducerWeightShortName(0)) == 0)
if (name.compare(m_wordTranslationFeatures[i]->GetScoreProducerWeightShortName()) == 0)
m_wordTranslationFeatures[i]->SetSparseFeatureReporting();
if (m_phrasePairFeatures.size() > 0)
for (size_t i=0; i < m_phrasePairFeatures.size(); ++i)
if (name.compare(m_phrasePairFeatures[i]->GetScoreProducerWeightShortName(0)) == 0)
if (name.compare(m_phrasePairFeatures[i]->GetScoreProducerWeightShortName()) == 0)
m_wordTranslationFeatures[i]->SetSparseFeatureReporting();
for (size_t j = 0; j < m_sparsePhraseDictionary.size(); ++j) {
if (m_sparsePhraseDictionary[j] && name.compare(m_sparsePhraseDictionary[j]->GetScoreProducerWeightShortName(0)) == 0) {
if (m_sparsePhraseDictionary[j] && name.compare(m_sparsePhraseDictionary[j]->GetScoreProducerWeightShortName()) == 0) {
m_sparsePhraseDictionary[j]->SetSparseFeatureReporting();
}
}

View File

@ -40,7 +40,7 @@ namespace Moses
return "Syntactic Language Model";
}
std::string SyntacticLanguageModel::GetScoreProducerWeightShortName(unsigned) const {
std::string SyntacticLanguageModel::GetScoreProducerWeightShortName() const {
return "slm";
}

View File

@ -27,7 +27,7 @@ namespace Moses
size_t GetNumScoreComponents() const;
std::string GetScoreProducerDescription(unsigned) const;
std::string GetScoreProducerWeightShortName(unsigned) const;
std::string GetScoreProducerWeightShortName() const;
const FFState* EmptyHypothesisState(const InputType &input) const;

View File

@ -33,7 +33,7 @@ bool TargetBigramFeature::Load(const std::string &filePath)
return true;
}
string TargetBigramFeature::GetScoreProducerWeightShortName(unsigned) const
string TargetBigramFeature::GetScoreProducerWeightShortName() const
{
return "dlmb";
}

View File

@ -39,7 +39,7 @@ public:
bool Load(const std::string &filePath);
std::string GetScoreProducerWeightShortName(unsigned) const;
std::string GetScoreProducerWeightShortName() const;
size_t GetNumInputScores() const;
virtual const FFState* EmptyHypothesisState(const InputType &input) const;

View File

@ -55,7 +55,7 @@ bool TargetNgramFeature::Load(const std::string &filePath)
return true;
}
string TargetNgramFeature::GetScoreProducerWeightShortName(unsigned) const
string TargetNgramFeature::GetScoreProducerWeightShortName() const
{
return "dlm";
}

View File

@ -196,7 +196,7 @@ public:
bool Load(const std::string &filePath);
std::string GetScoreProducerWeightShortName(unsigned) const;
std::string GetScoreProducerWeightShortName() const;
size_t GetNumInputScores() const;
void SetSparseProducerWeight(float weight) { m_sparseProducerWeight = weight; }

View File

@ -40,7 +40,7 @@ public:
const AlignmentInfo &alignmentInfo) const;
// basic properties
std::string GetScoreProducerWeightShortName(unsigned) const { return "twi"; }
std::string GetScoreProducerWeightShortName() const { return "twi"; }
size_t GetNumInputScores() const { return 0; }
};

View File

@ -304,13 +304,9 @@ PhraseDictionaryFeature::~PhraseDictionaryFeature()
{}
std::string PhraseDictionaryFeature::GetScoreProducerWeightShortName(unsigned idx) const
std::string PhraseDictionaryFeature::GetScoreProducerWeightShortName() const
{
if (idx < GetNumInputScores()){
return "I";
}else{
return "tm";
}
return "tm";
}

View File

@ -115,7 +115,7 @@ public:
virtual bool ComputeValueInTranslationOption() const;
std::string GetScoreProducerWeightShortName(unsigned idx=0) const;
std::string GetScoreProducerWeightShortName() const;
size_t GetNumInputScores() const;

View File

@ -137,7 +137,7 @@ public:
// for debugging
void PrintTargetCandidates(PrefixPtr p,std::ostream& out) const;
std::string GetScoreProducerDescription(unsigned) const;
std::string GetScoreProducerWeightShortName(unsigned) const {
std::string GetScoreProducerWeightShortName() const {
return "tm";
}
};

View File

@ -107,13 +107,9 @@ std::string PhraseDictionaryTreeAdaptor::GetScoreProducerDescription(unsigned id
}
}
std::string PhraseDictionaryTreeAdaptor::GetScoreProducerWeightShortName(unsigned idx) const
std::string PhraseDictionaryTreeAdaptor::GetScoreProducerWeightShortName() const
{
if (idx < imp->GetNumInputScores()){
return "I";
}else{
return "tm";
}
return "tm";
}
}

View File

@ -57,7 +57,7 @@ public:
TargetPhraseCollection const* GetTargetPhraseCollection(InputType const& src,WordsRange const & srcRange) const;
std::string GetScoreProducerDescription(unsigned idx=0) const;
std::string GetScoreProducerWeightShortName(unsigned idx=0) const;
std::string GetScoreProducerWeightShortName() const;
size_t GetNumInputScores() const;
virtual void InitializeForInput(InputType const& source);

View File

@ -80,7 +80,7 @@ public:
ScoreComponentCollection* accumulator) const;
// basic properties
std::string GetScoreProducerWeightShortName(unsigned) const { return "wt"; }
std::string GetScoreProducerWeightShortName() const { return "wt"; }
size_t GetNumInputScores() const { return 0; }
bool ComputeValueInTranslationOption() const {return true;}