get rid function GetScoreProducerWeightShortName(). Fails 1 regression test

This commit is contained in:
Hieu Hoang 2012-12-04 17:09:23 +00:00
parent 33105a7ba7
commit 9fe742ce52
36 changed files with 45 additions and 168 deletions

View File

@ -410,7 +410,7 @@ void OutputSparseFeatureScores(std::ostream& out, const ScoreComponentCollection
if (! ff->GetSparseFeatureReporting()) { if (! ff->GetSparseFeatureReporting()) {
const FVector &weights = staticData.GetAllWeights().GetScoresVector(); const FVector &weights = staticData.GetAllWeights().GetScoresVector();
if (labeledOutput && !boost::contains(ff->GetScoreProducerDescription(), ":")) if (labeledOutput && !boost::contains(ff->GetScoreProducerDescription(), ":"))
out << " " << ff->GetScoreProducerWeightShortName() << ":"; out << " " << ff->GetScoreProducerDescription() << ":";
out << " " << scores.inner_product(weights); out << " " << scores.inner_product(weights);
} }
@ -456,7 +456,7 @@ void WriteFeatures(const TranslationSystem &system, const ScoreComponentCollecti
for (size_t j = 0; j<scores.size(); ++j){ for (size_t j = 0; j<scores.size(); ++j){
if (labeledOutput && (i == 0) ){ if (labeledOutput && (i == 0) ){
if ((j == 0) || (j == pd_numinputscore)){ if ((j == 0) || (j == pd_numinputscore)){
lastName = pds[i]->GetScoreProducerWeightShortName(); lastName = pds[i]->GetScoreProducerDescription();
out << " " << lastName << ":"; out << " " << lastName << ":";
} }
} }
@ -479,7 +479,7 @@ void WriteFeatures(const TranslationSystem &system, const ScoreComponentCollecti
for (size_t j = 0; j<scores.size(); ++j){ for (size_t j = 0; j<scores.size(); ++j){
if (labeledOutput && (i == 0) ){ if (labeledOutput && (i == 0) ){
if ((j == 0) || (j == pd_numinputscore)){ if ((j == 0) || (j == pd_numinputscore)){
lastName = gds[i]->GetScoreProducerWeightShortName(); lastName = gds[i]->GetScoreProducerDescription();
out << " " << lastName << ":"; out << " " << lastName << ":";
} }
} }

View File

@ -186,16 +186,15 @@ static void PrintFeatureWeight(const FeatureFunction* ff)
vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff); vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff);
for (size_t i = 0; i < numScoreComps; ++i) for (size_t i = 0; i < numScoreComps; ++i)
cout << ff->GetScoreProducerDescription() << " " cout << ff->GetScoreProducerDescription() << " "
<< ff->GetScoreProducerWeightShortName() << " "
<< values[i] << endl; << values[i] << endl;
} }
else { else {
if (ff->GetSparseProducerWeight() == 1) if (ff->GetSparseProducerWeight() == 1)
cout << ff->GetScoreProducerDescription() << " " << cout << ff->GetScoreProducerDescription() << " "
ff->GetScoreProducerWeightShortName() << " sparse" << endl; << " sparse" << endl;
else else
cout << ff->GetScoreProducerDescription() << " " << cout << ff->GetScoreProducerDescription() << " "
ff->GetScoreProducerWeightShortName() << " " << ff->GetSparseProducerWeight() << endl; << ff->GetSparseProducerWeight() << endl;
} }
} }

View File

@ -400,7 +400,7 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con
if (labeledOutput && (i == 0) ){ if (labeledOutput && (i == 0) ){
if ((j == 0) || (j == pd_numinputscore)){ if ((j == 0) || (j == pd_numinputscore)){
lastName = pds[i]->GetScoreProducerWeightShortName(); lastName = pds[i]->GetScoreProducerDescription();
out << " " << lastName << ":"; out << " " << lastName << ":";
} }
} }
@ -420,7 +420,7 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con
if (labeledOutput && (i == 0) ){ if (labeledOutput && (i == 0) ){
if ((j == 0) || (j == pd_numinputscore)){ if ((j == 0) || (j == pd_numinputscore)){
lastName = gds[i]->GetScoreProducerWeightShortName(); lastName = gds[i]->GetScoreProducerDescription();
out << " " << lastName << ":"; out << " " << lastName << ":";
} }
} }
@ -481,15 +481,14 @@ void OutputAllFeatureScores( std::ostream& out, const TranslationSystem* system,
std::string lastName = ""; std::string lastName = "";
const vector<const StatefulFeatureFunction*>& sff = system->GetStatefulFeatureFunctions(); const vector<const StatefulFeatureFunction*>& sff = system->GetStatefulFeatureFunctions();
for( size_t i=0; i<sff.size(); i++ ) for( size_t i=0; i<sff.size(); i++ )
if (sff[i]->GetScoreProducerWeightShortName() != "bl") if (sff[i]->GetScoreProducerDescription() != "BleuScoreFeature")
OutputFeatureScores( out, path, sff[i], lastName ); OutputFeatureScores( out, path, sff[i], lastName );
const vector<const StatelessFeatureFunction*>& slf = system->GetStatelessFeatureFunctions(); const vector<const StatelessFeatureFunction*>& slf = system->GetStatelessFeatureFunctions();
for( size_t i=0; i<slf.size(); i++ ) for( size_t i=0; i<slf.size(); i++ )
if (slf[i]->GetScoreProducerWeightShortName() != "u" && if (slf[i]->GetScoreProducerDescription() != "!UnknownWordPenalty" &&
slf[i]->GetScoreProducerWeightShortName() != "tm" && slf[i]->GetScoreProducerDescription() != "PhraseModel" &&
slf[i]->GetScoreProducerWeightShortName() != "I" && slf[i]->GetScoreProducerDescription() != "Generation")
slf[i]->GetScoreProducerWeightShortName() != "g")
OutputFeatureScores( out, path, slf[i], lastName ); OutputFeatureScores( out, path, slf[i], lastName );
} }
@ -500,8 +499,8 @@ void OutputFeatureScores( std::ostream& out, const TrellisPath &path, const Feat
// regular features (not sparse) // regular features (not sparse)
if (ff->GetNumScoreComponents() != ScoreProducer::unlimited) { if (ff->GetNumScoreComponents() != ScoreProducer::unlimited) {
if( labeledOutput && lastName != ff->GetScoreProducerWeightShortName() ) { if( labeledOutput && lastName != ff->GetScoreProducerDescription() ) {
lastName = ff->GetScoreProducerWeightShortName(); lastName = ff->GetScoreProducerDescription();
out << " " << lastName << ":"; out << " " << lastName << ":";
} }
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer( ff ); vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer( ff );
@ -518,7 +517,7 @@ void OutputFeatureScores( std::ostream& out, const TrellisPath &path, const Feat
if (! ff->GetSparseFeatureReporting()) { if (! ff->GetSparseFeatureReporting()) {
const FVector &weights = staticData.GetAllWeights().GetScoresVector(); const FVector &weights = staticData.GetAllWeights().GetScoresVector();
if (labeledOutput && !boost::contains(ff->GetScoreProducerDescription(), ":")) if (labeledOutput && !boost::contains(ff->GetScoreProducerDescription(), ":"))
out << " " << ff->GetScoreProducerWeightShortName() << ":"; out << " " << ff->GetScoreProducerDescription() << ":";
out << " " << scores.inner_product(weights); out << " " << scores.inner_product(weights);
} }

View File

@ -319,16 +319,13 @@ static void PrintFeatureWeight(const FeatureFunction* ff)
vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff); vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff);
for (size_t i = 0; i < numScoreComps; ++i) for (size_t i = 0; i < numScoreComps; ++i)
cout << ff->GetScoreProducerDescription() << " " cout << ff->GetScoreProducerDescription() << " "
<< ff->GetScoreProducerWeightShortName() << " "
<< values[i] << endl; << values[i] << endl;
} }
else { else {
if (ff->GetSparseProducerWeight() == 1) if (ff->GetSparseProducerWeight() == 1)
cout << ff->GetScoreProducerDescription() << " " << cout << ff->GetScoreProducerDescription() << " sparse" << endl;
ff->GetScoreProducerWeightShortName() << " sparse" << endl;
else else
cout << ff->GetScoreProducerDescription() << " " << cout << ff->GetScoreProducerDescription() << " " << ff->GetSparseProducerWeight() << endl;
ff->GetScoreProducerWeightShortName() << " " << ff->GetSparseProducerWeight() << endl;
} }
} }
@ -344,10 +341,9 @@ static void ShowWeights()
PrintFeatureWeight(sff[i]); PrintFeatureWeight(sff[i]);
} }
for (size_t i = 0; i < slf.size(); ++i) { for (size_t i = 0; i < slf.size(); ++i) {
if (slf[i]->GetScoreProducerWeightShortName() != "u" && if (slf[i]->GetScoreProducerDescription() != "!UnknownWordPenalty" &&
slf[i]->GetScoreProducerWeightShortName() != "tm" && slf[i]->GetScoreProducerDescription() != "PhraseModel" &&
slf[i]->GetScoreProducerWeightShortName() != "I" && slf[i]->GetScoreProducerDescription() != "Generation")
slf[i]->GetScoreProducerWeightShortName() != "g")
{ {
PrintFeatureWeight(slf[i]); PrintFeatureWeight(slf[i]);
} }

View File

@ -85,11 +85,6 @@ public:
return "BleuScoreFeature"; return "BleuScoreFeature";
} }
std::string GetScoreProducerWeightShortName() const
{
return "bl";
}
void PrintHistory(std::ostream& out) const; void PrintHistory(std::ostream& out) const;
void LoadReferences(const std::vector< std::vector< std::string > > &); void LoadReferences(const std::vector< std::vector< std::string > > &);
void SetCurrSourceLength(size_t); void SetCurrSourceLength(size_t);

View File

@ -38,12 +38,6 @@ const FFState* DistortionScoreProducer::EmptyHypothesisState(const InputType &in
NOT_FOUND); NOT_FOUND);
} }
std::string DistortionScoreProducer::GetScoreProducerWeightShortName() const
{
return "d";
}
float DistortionScoreProducer::CalculateDistortionScore(const Hypothesis& hypo, float DistortionScoreProducer::CalculateDistortionScore(const Hypothesis& hypo,
const WordsRange &prev, const WordsRange &curr, const int FirstGap) const const WordsRange &prev, const WordsRange &curr, const int FirstGap) const
{ {
@ -107,12 +101,6 @@ FFState* DistortionScoreProducer::Evaluate(
return res; return res;
} }
std::string WordPenaltyProducer::GetScoreProducerWeightShortName() const
{
return "w";
}
void WordPenaltyProducer::Evaluate( void WordPenaltyProducer::Evaluate(
const PhraseBasedFeatureContext& context, const PhraseBasedFeatureContext& context,
ScoreComponentCollection* out) const ScoreComponentCollection* out) const
@ -121,20 +109,9 @@ void WordPenaltyProducer::Evaluate(
out->PlusEquals(this, -static_cast<float>(tp.GetSize())); out->PlusEquals(this, -static_cast<float>(tp.GetSize()));
} }
std::string UnknownWordPenaltyProducer::GetScoreProducerWeightShortName() const
{
return "u";
}
bool UnknownWordPenaltyProducer::ComputeValueInTranslationOption() const bool UnknownWordPenaltyProducer::ComputeValueInTranslationOption() const
{ {
return true; return true;
} }
std::string MetaFeatureProducer::GetScoreProducerWeightShortName() const
{
return "m"+m_shortName;
}
} }

View File

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

View File

@ -71,11 +71,6 @@ public:
//! load data file //! load data file
bool Load(const std::string &filePath, FactorDirection direction); bool Load(const std::string &filePath, FactorDirection direction);
std::string GetScoreProducerWeightShortName() const
{
return "g";
}
/** number of unique input entries in the generation table. /** number of unique input entries in the generation table.
* NOT the number of lines in the generation table * NOT the number of lines in the generation table
*/ */

View File

@ -68,10 +68,6 @@ public:
const std::vector< FactorType >& outFactors); const std::vector< FactorType >& outFactors);
virtual ~GlobalLexicalModel(); virtual ~GlobalLexicalModel();
virtual std::string GetScoreProducerWeightShortName() const {
return "lex";
};
void InitializeForInput( Sentence const& in ); void InitializeForInput( Sentence const& in );
void Evaluate(const PhraseBasedFeatureContext& context, void Evaluate(const PhraseBasedFeatureContext& context,

View File

@ -109,10 +109,6 @@ public:
std::cerr << "done." << std::endl; std::cerr << "done." << std::endl;
} }
std::string GetScoreProducerWeightShortName() const {
return "glm";
};
bool Load(const std::string &filePathSource, const std::string &filePathTarget); bool Load(const std::string &filePathSource, const std::string &filePathTarget);
void InitializeForInput( Sentence const& in ); void InitializeForInput( Sentence const& in );

View File

@ -58,10 +58,6 @@ public:
float GetWeight() const; float GetWeight() const;
float GetOOVWeight() const; float GetOOVWeight() const;
std::string GetScoreProducerWeightShortName() const {
return "lm";
}
virtual void InitializeBeforeSentenceProcessing() {} virtual void InitializeBeforeSentenceProcessing() {}
virtual void CleanUpAfterSentenceProcessing(const InputType& source) {} virtual void CleanUpAfterSentenceProcessing(const InputType& source) {}

View File

@ -114,11 +114,6 @@ public:
return m_sentenceEndArray; return m_sentenceEndArray;
} }
std::string GetScoreProducerWeightShortName() const {
return "lm";
}
//! overrideable funtions for IRST LM to cleanup. Maybe something to do with on demand/cache loading/unloading //! overrideable funtions for IRST LM to cleanup. Maybe something to do with on demand/cache loading/unloading
virtual void InitializeBeforeSentenceProcessing() {}; virtual void InitializeBeforeSentenceProcessing() {};
virtual void CleanUpAfterSentenceProcessing(const InputType& source) {}; virtual void CleanUpAfterSentenceProcessing(const InputType& source) {};

View File

@ -38,12 +38,7 @@ public:
ScoreComponentCollection* accumulator) const; ScoreComponentCollection* accumulator) const;
virtual const FFState* EmptyHypothesisState(const InputType &input) const; virtual const FFState* EmptyHypothesisState(const InputType &input) const;
std::string GetScoreProducerWeightShortName() const {
return "d";
};
void InitializeForInput(const InputType& i){ void InitializeForInput(const InputType& i){
m_table->InitializeForInput(i); m_table->InitializeForInput(i);
} }

View File

@ -22,11 +22,6 @@ PhraseBoundaryFeature::PhraseBoundaryFeature
{ {
} }
string PhraseBoundaryFeature::GetScoreProducerWeightShortName() const
{
return "pb";
}
size_t PhraseBoundaryFeature::GetNumInputScores() const size_t PhraseBoundaryFeature::GetNumInputScores() const
{ {
return 0; return 0;

View File

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

View File

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

View File

@ -11,11 +11,6 @@ using namespace std;
namespace Moses { namespace Moses {
string PhrasePairFeature::GetScoreProducerWeightShortName() const
{
return "pp";
}
size_t PhrasePairFeature::GetNumInputScores() const size_t PhrasePairFeature::GetNumInputScores() const
{ {
return 0; return 0;

View File

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

View File

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

View File

@ -46,9 +46,6 @@ public:
//! returns a string description of this producer //! returns a string description of this producer
const std::string& GetScoreProducerDescription() const {return m_description;} 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() const = 0;
//! returns the number of scores gathered from the input (0 by default) //! returns the number of scores gathered from the input (0 by default)
virtual size_t GetNumInputScores() const { virtual size_t GetNumInputScores() const {
return 0; return 0;

View File

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

View File

@ -28,7 +28,6 @@ public:
} }
// basic properties // basic properties
std::string GetScoreProducerWeightShortName() const { return "stm"; }
size_t GetNumInputScores() const { return 0; } 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) { if (m_parameter->GetParam("report-sparse-features").size() > 0) {
for(size_t i=0; i<m_parameter->GetParam("report-sparse-features").size(); i++) { 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]; const std::string &name = m_parameter->GetParam("report-sparse-features")[i];
if (m_targetBigramFeature && name.compare(m_targetBigramFeature->GetScoreProducerWeightShortName()) == 0) if (m_targetBigramFeature && name.compare(m_targetBigramFeature->GetScoreProducerDescription()) == 0)
m_targetBigramFeature->SetSparseFeatureReporting(); m_targetBigramFeature->SetSparseFeatureReporting();
if (m_targetNgramFeatures.size() > 0) if (m_targetNgramFeatures.size() > 0)
for (size_t i=0; i < m_targetNgramFeatures.size(); ++i) for (size_t i=0; i < m_targetNgramFeatures.size(); ++i)
if (name.compare(m_targetNgramFeatures[i]->GetScoreProducerWeightShortName()) == 0) if (name.compare(m_targetNgramFeatures[i]->GetScoreProducerDescription()) == 0)
m_targetNgramFeatures[i]->SetSparseFeatureReporting(); m_targetNgramFeatures[i]->SetSparseFeatureReporting();
if (m_phraseBoundaryFeature && name.compare(m_phraseBoundaryFeature->GetScoreProducerWeightShortName()) == 0) if (m_phraseBoundaryFeature && name.compare(m_phraseBoundaryFeature->GetScoreProducerDescription()) == 0)
m_phraseBoundaryFeature->SetSparseFeatureReporting(); m_phraseBoundaryFeature->SetSparseFeatureReporting();
if (m_phraseLengthFeature && name.compare(m_phraseLengthFeature->GetScoreProducerWeightShortName()) == 0) if (m_phraseLengthFeature && name.compare(m_phraseLengthFeature->GetScoreProducerDescription()) == 0)
m_phraseLengthFeature->SetSparseFeatureReporting(); m_phraseLengthFeature->SetSparseFeatureReporting();
if (m_targetWordInsertionFeature && name.compare(m_targetWordInsertionFeature->GetScoreProducerWeightShortName()) == 0) if (m_targetWordInsertionFeature && name.compare(m_targetWordInsertionFeature->GetScoreProducerDescription()) == 0)
m_targetWordInsertionFeature->SetSparseFeatureReporting(); m_targetWordInsertionFeature->SetSparseFeatureReporting();
if (m_sourceWordDeletionFeature && name.compare(m_sourceWordDeletionFeature->GetScoreProducerWeightShortName()) == 0) if (m_sourceWordDeletionFeature && name.compare(m_sourceWordDeletionFeature->GetScoreProducerDescription()) == 0)
m_sourceWordDeletionFeature->SetSparseFeatureReporting(); m_sourceWordDeletionFeature->SetSparseFeatureReporting();
if (m_wordTranslationFeatures.size() > 0) if (m_wordTranslationFeatures.size() > 0)
for (size_t i=0; i < m_wordTranslationFeatures.size(); ++i) for (size_t i=0; i < m_wordTranslationFeatures.size(); ++i)
if (name.compare(m_wordTranslationFeatures[i]->GetScoreProducerWeightShortName()) == 0) if (name.compare(m_wordTranslationFeatures[i]->GetScoreProducerDescription()) == 0)
m_wordTranslationFeatures[i]->SetSparseFeatureReporting(); m_wordTranslationFeatures[i]->SetSparseFeatureReporting();
if (m_phrasePairFeatures.size() > 0) if (m_phrasePairFeatures.size() > 0)
for (size_t i=0; i < m_phrasePairFeatures.size(); ++i) for (size_t i=0; i < m_phrasePairFeatures.size(); ++i)
if (name.compare(m_phrasePairFeatures[i]->GetScoreProducerWeightShortName()) == 0) if (name.compare(m_phrasePairFeatures[i]->GetScoreProducerDescription()) == 0)
m_wordTranslationFeatures[i]->SetSparseFeatureReporting(); m_wordTranslationFeatures[i]->SetSparseFeatureReporting();
for (size_t j = 0; j < m_sparsePhraseDictionary.size(); ++j) { for (size_t j = 0; j < m_sparsePhraseDictionary.size(); ++j) {
if (m_sparsePhraseDictionary[j] && name.compare(m_sparsePhraseDictionary[j]->GetScoreProducerWeightShortName()) == 0) { if (m_sparsePhraseDictionary[j] && name.compare(m_sparsePhraseDictionary[j]->GetScoreProducerDescription()) == 0) {
m_sparsePhraseDictionary[j]->SetSparseFeatureReporting(); m_sparsePhraseDictionary[j]->SetSparseFeatureReporting();
} }
} }
@ -1990,6 +1990,8 @@ void StaticData::ClearTransOptionCache() const {
void StaticData::ReLoadParameter() void StaticData::ReLoadParameter()
{ {
assert(false); // TODO completely redo. Too many hardcoded ff
/*
m_verboseLevel = 1; m_verboseLevel = 1;
if (m_parameter->GetParam("verbose").size() == 1) { if (m_parameter->GetParam("verbose").size() == 1) {
m_verboseLevel = Scan<size_t>( m_parameter->GetParam("verbose")[0]); m_verboseLevel = Scan<size_t>( m_parameter->GetParam("verbose")[0]);
@ -2049,11 +2051,13 @@ void StaticData::ReLoadParameter()
SetWeights(&phraseDictionaryFeature, tmp_weights); SetWeights(&phraseDictionaryFeature, tmp_weights);
} }
*/
} }
void StaticData::ReLoadBleuScoreFeatureParameter(float weight) void StaticData::ReLoadBleuScoreFeatureParameter(float weight)
{ {
assert(false);
/*
//loop over ScoreProducers to update weights of BleuScoreFeature //loop over ScoreProducers to update weights of BleuScoreFeature
const TranslationSystem &transSystem = GetTranslationSystem(TranslationSystem::DEFAULT); const TranslationSystem &transSystem = GetTranslationSystem(TranslationSystem::DEFAULT);
@ -2065,6 +2069,7 @@ void StaticData::ReLoadBleuScoreFeatureParameter(float weight)
break; break;
} }
} }
*/
} }
// ScoreComponentCollection StaticData::GetAllWeightsScoreComponentCollection() const {} // ScoreComponentCollection StaticData::GetAllWeightsScoreComponentCollection() const {}

View File

@ -36,14 +36,10 @@ namespace Moses
return m_NumScoreComponents; return m_NumScoreComponents;
} }
std::string SyntacticLanguageModel::GetScoreProducerDescription(unsigned) const { std::string SyntacticLanguageModel::GetScoreProducerDescription() const {
return "Syntactic Language Model"; return "Syntactic Language Model";
} }
std::string SyntacticLanguageModel::GetScoreProducerWeightShortName() const {
return "slm";
}
const FFState* SyntacticLanguageModel::EmptyHypothesisState(const InputType &input) const { const FFState* SyntacticLanguageModel::EmptyHypothesisState(const InputType &input) const {
return new SyntacticLanguageModelState<YModel,XModel,S,R>(m_files,m_beamWidth); return new SyntacticLanguageModelState<YModel,XModel,S,R>(m_files,m_beamWidth);

View File

@ -33,11 +33,6 @@ bool TargetBigramFeature::Load(const std::string &filePath)
return true; return true;
} }
string TargetBigramFeature::GetScoreProducerWeightShortName() const
{
return "dlmb";
}
size_t TargetBigramFeature::GetNumInputScores() const size_t TargetBigramFeature::GetNumInputScores() const
{ {
return 0; return 0;

View File

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

View File

@ -55,11 +55,6 @@ bool TargetNgramFeature::Load(const std::string &filePath)
return true; return true;
} }
string TargetNgramFeature::GetScoreProducerWeightShortName() const
{
return "dlm";
}
size_t TargetNgramFeature::GetNumInputScores() const size_t TargetNgramFeature::GetNumInputScores() const
{ {
return 0; return 0;

View File

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

View File

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

View File

@ -303,13 +303,6 @@ PhraseDictionary* PhraseDictionaryFeature::GetDictionary()
PhraseDictionaryFeature::~PhraseDictionaryFeature() PhraseDictionaryFeature::~PhraseDictionaryFeature()
{} {}
std::string PhraseDictionaryFeature::GetScoreProducerWeightShortName() const
{
return "tm";
}
size_t PhraseDictionaryFeature::GetNumInputScores() const size_t PhraseDictionaryFeature::GetNumInputScores() const
{ {
return m_numInputScores; return m_numInputScores;

View File

@ -115,8 +115,6 @@ public:
virtual bool ComputeValueInTranslationOption() const; virtual bool ComputeValueInTranslationOption() const;
std::string GetScoreProducerWeightShortName() const;
size_t GetNumInputScores() const; size_t GetNumInputScores() const;
SparsePhraseDictionaryFeature* GetSparsePhraseDictionaryFeature() const { SparsePhraseDictionaryFeature* GetSparsePhraseDictionaryFeature() const {

View File

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

View File

@ -99,17 +99,8 @@ size_t PhraseDictionaryTreeAdaptor::GetNumInputScores() const
return imp->GetNumInputScores(); return imp->GetNumInputScores();
} }
std::string PhraseDictionaryTreeAdaptor::GetScoreProducerDescription(unsigned idx) const{ std::string PhraseDictionaryTreeAdaptor::GetScoreProducerDescription() const{
if (idx < imp->GetNumInputScores()){ return "PhraseModel";
return "InputScore";
}else{
return "PhraseModel";
}
}
std::string PhraseDictionaryTreeAdaptor::GetScoreProducerWeightShortName() const
{
return "tm";
} }
} }

View File

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

View File

@ -120,15 +120,16 @@ namespace Moses {
for(size_t i=0;i<m_globalLexicalModels.size();++i) { for(size_t i=0;i<m_globalLexicalModels.size();++i) {
m_globalLexicalModels[i]->InitializeForInput((Sentence const&)source); m_globalLexicalModels[i]->InitializeForInput((Sentence const&)source);
} }
//for(size_t i=0;i<m_statefulFFs.size();++i) {
//} /* TODO - get rid of GetScoreProducerWeightShortName()
for(size_t i=0;i<m_statelessFFs.size();++i) { for(size_t i=0;i<m_statelessFFs.size();++i) {
if (m_statelessFFs[i]->GetScoreProducerWeightShortName() == "glm") if (m_statelessFFs[i]->GetScoreProducerWeightShortName() == "glm")
{ {
((GlobalLexicalModelUnlimited*)m_statelessFFs[i])->InitializeForInput((Sentence const&)source); ((GlobalLexicalModelUnlimited*)m_statelessFFs[i])->InitializeForInput((Sentence const&)source);
} }
} }
*/
LMList::const_iterator iterLM; LMList::const_iterator iterLM;
for (iterLM = m_languageModels.begin() ; iterLM != m_languageModels.end() ; ++iterLM) for (iterLM = m_languageModels.begin() ; iterLM != m_languageModels.end() ; ++iterLM)
{ {

View File

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