diff options
37 files changed, 204 insertions, 283 deletions
diff --git a/contrib/other-builds/moses/.project b/contrib/other-builds/moses/.project index 09dabb2c6..d3ac7f39a 100644 --- a/contrib/other-builds/moses/.project +++ b/contrib/other-builds/moses/.project @@ -802,16 +802,6 @@ <locationURI>PARENT-3-PROJECT_LOC/moses/ScoreComponentCollectionTest.cpp</locationURI> </link> <link> - <name>ScoreProducer.cpp</name> - <type>1</type> - <locationURI>PARENT-3-PROJECT_LOC/moses/ScoreProducer.cpp</locationURI> - </link> - <link> - <name>ScoreProducer.h</name> - <type>1</type> - <locationURI>PARENT-3-PROJECT_LOC/moses/ScoreProducer.h</locationURI> - </link> - <link> <name>Search.cpp</name> <type>1</type> <locationURI>PARENT-3-PROJECT_LOC/moses/Search.cpp</locationURI> diff --git a/mira/Main.cpp b/mira/Main.cpp index 9497de847..e944009be 100644 --- a/mira/Main.cpp +++ b/mira/Main.cpp @@ -1960,7 +1960,7 @@ void applyPerFeatureLearningRates(vector<vector<ScoreComponentCollection> > &fea featureValues[i][j].MultiplyEqualsBackoff(featureLearningRates, sparse_r0); } -void scaleFeatureScore(ScoreProducer *sp, float scaling_factor, vector<vector<ScoreComponentCollection> > &featureValues, size_t rank, size_t epoch) { +void scaleFeatureScore(FeatureFunction *sp, float scaling_factor, vector<vector<ScoreComponentCollection> > &featureValues, size_t rank, size_t epoch) { string name = sp->GetScoreProducerDescription(); // scale down score @@ -1974,7 +1974,7 @@ void scaleFeatureScore(ScoreProducer *sp, float scaling_factor, vector<vector<Sc } } -void scaleFeatureScores(ScoreProducer *sp, float scaling_factor, vector<vector<ScoreComponentCollection> > &featureValues, size_t rank, size_t epoch) { +void scaleFeatureScores(FeatureFunction *sp, float scaling_factor, vector<vector<ScoreComponentCollection> > &featureValues, size_t rank, size_t epoch) { string name = sp->GetScoreProducerDescription(); // scale down score diff --git a/mira/Main.h b/mira/Main.h index 60b239fd6..97bb52f86 100644 --- a/mira/Main.h +++ b/mira/Main.h @@ -23,11 +23,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "moses/ScoreComponentCollection.h" #include "moses/Word.h" -#include "moses/ScoreProducer.h" +#include "moses/FeatureFunction.h" #include "Decoder.h" -typedef std::map<const Moses::ScoreProducer*, std::vector< float > > ProducerWeightMap; -typedef std::pair<const Moses::ScoreProducer*, std::vector< float > > ProducerWeightPair; +typedef std::map<const Moses::FeatureFunction*, std::vector< float > > ProducerWeightMap; +typedef std::pair<const Moses::FeatureFunction*, std::vector< float > > ProducerWeightPair; template <class T> bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)) { @@ -52,7 +52,7 @@ void deleteTranslations(std::vector<std::vector<const Moses::Word*> > &translati void decodeHopeOrFear(size_t rank, size_t size, size_t decode, std::string decode_filename, std::vector<std::string> &inputSentences, Mira::MosesDecoder* decoder, size_t n, float bleuWeight); void applyLearningRates(std::vector<std::vector<Moses::ScoreComponentCollection> > &featureValues, float core_r0, float sparse_r0); void applyPerFeatureLearningRates(std::vector<std::vector<Moses::ScoreComponentCollection> > &featureValues, Moses::ScoreComponentCollection featureLearningRates, float sparse_r0); -void scaleFeatureScore(Moses::ScoreProducer *sp, float scaling_factor, std::vector<std::vector<Moses::ScoreComponentCollection> > &featureValues, size_t rank, size_t epoch); -void scaleFeatureScores(Moses::ScoreProducer *sp, float scaling_factor, std::vector<std::vector<Moses::ScoreComponentCollection> > &featureValues, size_t rank, size_t epoch); +void scaleFeatureScore(Moses::FeatureFunction *sp, float scaling_factor, std::vector<std::vector<Moses::ScoreComponentCollection> > &featureValues, size_t rank, size_t epoch); +void scaleFeatureScores(Moses::FeatureFunction *sp, float scaling_factor, std::vector<std::vector<Moses::ScoreComponentCollection> > &featureValues, size_t rank, size_t epoch); #endif /* MAIN_H_ */ diff --git a/moses-chart-cmd/IOWrapper.cpp b/moses-chart-cmd/IOWrapper.cpp index 74fcdf6f2..d12bcefb1 100644 --- a/moses-chart-cmd/IOWrapper.cpp +++ b/moses-chart-cmd/IOWrapper.cpp @@ -425,7 +425,7 @@ void IOWrapper::OutputFeatureScores( std::ostream& out, const ScoreComponentColl bool labeledOutput = staticData.IsLabeledNBestList(); // regular features (not sparse) - if (ff->GetNumScoreComponents() != ScoreProducer::unlimited) { + if (ff->GetNumScoreComponents() != FeatureFunction::unlimited) { if( labeledOutput && lastName != ff->GetScoreProducerDescription() ) { lastName = ff->GetScoreProducerDescription(); out << " " << lastName << "="; diff --git a/moses-chart-cmd/Main.cpp b/moses-chart-cmd/Main.cpp index 7bc5acfd8..44b657c19 100644 --- a/moses-chart-cmd/Main.cpp +++ b/moses-chart-cmd/Main.cpp @@ -189,7 +189,7 @@ bool ReadInput(IOWrapper &ioWrapper, InputTypeEnum inputType, InputType*& source static void PrintFeatureWeight(const FeatureFunction* ff) { size_t numScoreComps = ff->GetNumScoreComponents(); - if (numScoreComps != ScoreProducer::unlimited) { + if (numScoreComps != FeatureFunction::unlimited) { vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff); cout << ff->GetScoreProducerDescription() << "="; for (size_t i = 0; i < numScoreComps; ++i) { diff --git a/moses-cmd/IOWrapper.cpp b/moses-cmd/IOWrapper.cpp index 87f39e6ba..a48b753d6 100644 --- a/moses-cmd/IOWrapper.cpp +++ b/moses-cmd/IOWrapper.cpp @@ -471,7 +471,7 @@ void OutputFeatureScores( std::ostream& out bool labeledOutput = staticData.IsLabeledNBestList(); // regular features (not sparse) - if (ff->GetNumScoreComponents() != ScoreProducer::unlimited) { + if (ff->GetNumScoreComponents() != FeatureFunction::unlimited) { if( labeledOutput && lastName != ff->GetScoreProducerDescription() ) { lastName = ff->GetScoreProducerDescription(); out << " " << lastName << "="; diff --git a/moses-cmd/Main.cpp b/moses-cmd/Main.cpp index bbab94d38..72370d5d4 100644 --- a/moses-cmd/Main.cpp +++ b/moses-cmd/Main.cpp @@ -319,7 +319,7 @@ private: static void PrintFeatureWeight(const FeatureFunction* ff) { size_t numScoreComps = ff->GetNumScoreComponents(); - if (numScoreComps != ScoreProducer::unlimited) { + if (numScoreComps != FeatureFunction::unlimited) { vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff); cout << ff->GetScoreProducerDescription() << "="; for (size_t i = 0; i < numScoreComps; ++i) { diff --git a/moses/ChartManager.cpp b/moses/ChartManager.cpp index 15c37fa0a..010c92a78 100644 --- a/moses/ChartManager.cpp +++ b/moses/ChartManager.cpp @@ -136,7 +136,7 @@ void ChartManager::AddXmlChartOptions() { ChartTranslationOptions* opt = *i; Moses::Scores wordPenaltyScore(1, -0.434294482); // TODO what is this number? - opt->GetTargetPhraseCollection().GetCollection()[0]->SetScore((ScoreProducer*)staticData.GetWordPenaltyProducer(), wordPenaltyScore); + opt->GetTargetPhraseCollection().GetCollection()[0]->SetScore((FeatureFunction*)staticData.GetWordPenaltyProducer(), wordPenaltyScore); const WordsRange &range = opt->GetSourceWordsRange(); RuleCubeItem* item = new RuleCubeItem( *opt, m_hypoStackColl ); diff --git a/moses/DummyScoreProducers.h b/moses/DummyScoreProducers.h index 80dc7adc4..54d985f49 100644 --- a/moses/DummyScoreProducers.h +++ b/moses/DummyScoreProducers.h @@ -4,6 +4,7 @@ #define moses_DummyScoreProducers_h #include "FeatureFunction.h" +#include "util/check.hh" namespace Moses { diff --git a/moses/FeatureFunction.cpp b/moses/FeatureFunction.cpp index 645532703..eae145be3 100644 --- a/moses/FeatureFunction.cpp +++ b/moses/FeatureFunction.cpp @@ -9,6 +9,7 @@ #include "Manager.h" #include "TranslationOption.h" +using namespace std; namespace Moses { @@ -71,25 +72,86 @@ const TargetPhrase& ChartBasedFeatureContext::GetTargetPhrase() const return m_targetPhrase; } +multiset<string> FeatureFunction::description_counts; +const size_t FeatureFunction::unlimited = -1; + std::vector<FeatureFunction*> FeatureFunction::m_producers; std::vector<const StatelessFeatureFunction*> StatelessFeatureFunction::m_statelessFFs; std::vector<const StatefulFeatureFunction*> StatefulFeatureFunction::m_statefulFFs; FeatureFunction::FeatureFunction(const std::string& description, const std::string &line) -: ScoreProducer(description, line) +: m_reportSparseFeatures(false) { + ParseLine(description, line); + m_numScoreComponents = FindNumFeatures(); + size_t index = description_counts.count(description); + + ostringstream dstream; + dstream << description; + dstream << index; + + description_counts.insert(description); + + m_description = dstream.str(); + if (m_numScoreComponents != unlimited) + { + ScoreComponentCollection::RegisterScoreProducer(this); + } + m_producers.push_back(this); } FeatureFunction::FeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line) -: ScoreProducer(description, numScoreComponents, line) +: m_reportSparseFeatures(false), m_numScoreComponents(numScoreComponents) { + ParseLine(description, line); + size_t index = description_counts.count(description); + + ostringstream dstream; + dstream << description; + dstream << index; + + description_counts.insert(description); + + m_description = dstream.str(); + if (numScoreComponents != unlimited) + { + ScoreComponentCollection::RegisterScoreProducer(this); + } + m_producers.push_back(this); } FeatureFunction::~FeatureFunction() {} +void FeatureFunction::ParseLine(const std::string& description, const std::string &line) +{ + cerr << "line=" << line << endl; + vector<string> toks = Tokenize(line); + + CHECK(toks.size()); + //CHECK(toks[0] == description); + + for (size_t i = 1; i < toks.size(); ++i) { + vector<string> args = Tokenize(toks[i], "="); + CHECK(args.size() == 2); + m_args.push_back(args); + } +} + +size_t FeatureFunction::FindNumFeatures() +{ + for (size_t i = 0; i < m_args.size(); ++i) { + if (m_args[i][0] == "num-features") { + size_t ret = Scan<size_t>(m_args[i][1]); + m_args.erase(m_args.begin() + i); + return ret; + } + } + abort(); +} + StatelessFeatureFunction::StatelessFeatureFunction(const std::string& description, const std::string &line) :FeatureFunction(description, line) { diff --git a/moses/FeatureFunction.h b/moses/FeatureFunction.h index c65c93888..81a5b4375 100644 --- a/moses/FeatureFunction.h +++ b/moses/FeatureFunction.h @@ -2,8 +2,8 @@ #define moses_FeatureFunction_h #include <vector> - -#include "ScoreProducer.h" +#include <set> +#include <string> namespace Moses { @@ -72,13 +72,23 @@ public: /** base class for all feature functions. * @todo is this for pb & hiero too? - * @todo what's the diff between FeatureFunction and ScoreProducer? */ -class FeatureFunction: public ScoreProducer +class FeatureFunction { +protected: /**< all the score producers in this run */ static std::vector<FeatureFunction*> m_producers; + std::string m_description, m_argLine; + std::vector<std::vector<std::string> > m_args; + bool m_reportSparseFeatures; + size_t m_numScoreComponents; + //In case there's multiple producers with the same description + static std::multiset<std::string> description_counts; + + void ParseLine(const std::string& description, const std::string &line); + size_t FindNumFeatures(); + public: static const std::vector<FeatureFunction*>& GetFeatureFunctions() { return m_producers; } @@ -87,7 +97,39 @@ public: virtual bool IsStateless() const = 0; virtual ~FeatureFunction(); - float GetSparseProducerWeight() const { return 1; } + static const size_t unlimited; + + static void ResetDescriptionCounts() { + description_counts.clear(); + } + + //! returns the number of scores that a subclass produces. + //! For example, a language model conventionally produces 1, a translation table some arbitrary number, etc + //! sparse features returned unlimited + size_t GetNumScoreComponents() const {return m_numScoreComponents;} + + //! returns a string description of this producer + const std::string& GetScoreProducerDescription() const + { return m_description; } + + void SetSparseFeatureReporting() { m_reportSparseFeatures = true; } + bool GetSparseFeatureReporting() const { return m_reportSparseFeatures; } + + virtual float GetSparseProducerWeight() const { return 1; } + + virtual bool IsTuneable() const { return true; } + + //! + virtual void InitializeForInput(InputType const& source) + {} + + // clean up temporary memory, called after processing each sentence + virtual void CleanUpAfterSentenceProcessing(const InputType& source) + {} + + const std::string &GetArgLine() const + { return m_argLine; } + }; /** base class for all stateless feature functions. diff --git a/moses/GlobalLexicalModel.h b/moses/GlobalLexicalModel.h index 2e9f3badb..770544e6c 100644 --- a/moses/GlobalLexicalModel.h +++ b/moses/GlobalLexicalModel.h @@ -9,7 +9,6 @@ #include "TypeDef.h" #include "Util.h" #include "WordsRange.h" -#include "ScoreProducer.h" #include "FeatureFunction.h" #include "FactorTypeSet.h" #include "Sentence.h" diff --git a/moses/GlobalLexicalModelUnlimited.cpp b/moses/GlobalLexicalModelUnlimited.cpp index c39fa3cd2..a8d21c4f6 100644 --- a/moses/GlobalLexicalModelUnlimited.cpp +++ b/moses/GlobalLexicalModelUnlimited.cpp @@ -9,7 +9,7 @@ using namespace std; namespace Moses { GlobalLexicalModelUnlimited::GlobalLexicalModelUnlimited(const std::string &line) -:StatelessFeatureFunction("glm",ScoreProducer::unlimited, line) +:StatelessFeatureFunction("glm",FeatureFunction::unlimited, line) { const vector<string> modelSpec = Tokenize(line); diff --git a/moses/GlobalLexicalModelUnlimited.h b/moses/GlobalLexicalModelUnlimited.h index 15889f6c5..b30fad2c0 100644 --- a/moses/GlobalLexicalModelUnlimited.h +++ b/moses/GlobalLexicalModelUnlimited.h @@ -8,7 +8,6 @@ #include "TypeDef.h" #include "Util.h" #include "WordsRange.h" -#include "ScoreProducer.h" #include "FeatureFunction.h" #include "FactorTypeSet.h" #include "Sentence.h" diff --git a/moses/LexicalReordering.h b/moses/LexicalReordering.h index 41c6702d4..6e24f82b7 100644 --- a/moses/LexicalReordering.h +++ b/moses/LexicalReordering.h @@ -8,7 +8,6 @@ #include "TypeDef.h" #include "Util.h" #include "WordsRange.h" -#include "ScoreProducer.h" #include "FeatureFunction.h" #include "LexicalReorderingState.h" diff --git a/moses/LexicalReorderingState.h b/moses/LexicalReorderingState.h index 0eb4cc42e..f629fa38b 100644 --- a/moses/LexicalReorderingState.h +++ b/moses/LexicalReorderingState.h @@ -37,7 +37,7 @@ public: void SetAdditionalScoreComponents(size_t number); size_t GetNumberOfTypes() const; - ScoreProducer *GetScoreProducer() const { + FeatureFunction *GetScoreProducer() const { return m_scoreProducer; } @@ -63,7 +63,7 @@ public: } private: - void SetScoreProducer(ScoreProducer* scoreProducer) { + void SetScoreProducer(FeatureFunction* scoreProducer) { m_scoreProducer = scoreProducer; } @@ -72,7 +72,7 @@ private: } std::string m_modelString; - ScoreProducer *m_scoreProducer; + FeatureFunction *m_scoreProducer; ModelType m_modelType; bool m_phraseBased; bool m_collapseScores; diff --git a/moses/PhraseBoundaryFeature.cpp b/moses/PhraseBoundaryFeature.cpp index dac3b69fe..7c8dd0b32 100644 --- a/moses/PhraseBoundaryFeature.cpp +++ b/moses/PhraseBoundaryFeature.cpp @@ -15,7 +15,7 @@ int PhraseBoundaryState::Compare(const FFState& other) const } PhraseBoundaryFeature::PhraseBoundaryFeature(const std::string &line) -: StatefulFeatureFunction("PhraseBoundaryFeature", ScoreProducer::unlimited, line) +: StatefulFeatureFunction("PhraseBoundaryFeature", FeatureFunction::unlimited, line) { std::cerr << "Initializing source word deletion feature.." << std::endl; diff --git a/moses/PhraseLengthFeature.cpp b/moses/PhraseLengthFeature.cpp index e854075fc..296abb6c1 100644 --- a/moses/PhraseLengthFeature.cpp +++ b/moses/PhraseLengthFeature.cpp @@ -9,7 +9,7 @@ namespace Moses { using namespace std; PhraseLengthFeature::PhraseLengthFeature(const std::string &line) -:StatelessFeatureFunction("pl", ScoreProducer::unlimited, line) +:StatelessFeatureFunction("pl", FeatureFunction::unlimited, line) { } diff --git a/moses/PhrasePairFeature.cpp b/moses/PhrasePairFeature.cpp index 225e06317..33ae57877 100644 --- a/moses/PhrasePairFeature.cpp +++ b/moses/PhrasePairFeature.cpp @@ -12,7 +12,7 @@ using namespace std; namespace Moses { PhrasePairFeature::PhrasePairFeature(const std::string &line) -:StatelessFeatureFunction("PhrasePairFeature", ScoreProducer::unlimited, line) +:StatelessFeatureFunction("PhrasePairFeature", FeatureFunction::unlimited, line) { std::cerr << "Initializing PhrasePairFeature.." << std::endl; diff --git a/moses/ReorderingStack.h b/moses/ReorderingStack.h index d819e5f47..730b17ce3 100644 --- a/moses/ReorderingStack.h +++ b/moses/ReorderingStack.h @@ -13,8 +13,6 @@ //#include "TypeDef.h" //#include "Util.h" #include "WordsRange.h" -//#include "ScoreProducer.h" -//#include "FeatureFunction.h" namespace Moses { diff --git a/moses/ScoreComponentCollection.cpp b/moses/ScoreComponentCollection.cpp index d0c1e11ed..eb70d526c 100644 --- a/moses/ScoreComponentCollection.cpp +++ b/moses/ScoreComponentCollection.cpp @@ -17,20 +17,20 @@ ScoreComponentCollection::ScoreComponentCollection() : m_scores(s_denseVectorSiz void ScoreComponentCollection::RegisterScoreProducer - (const ScoreProducer* scoreProducer) + (const FeatureFunction* scoreProducer) { - CHECK(scoreProducer->GetNumScoreComponents() != ScoreProducer::unlimited); + CHECK(scoreProducer->GetNumScoreComponents() != FeatureFunction::unlimited); size_t start = s_denseVectorSize; size_t end = start + scoreProducer->GetNumScoreComponents(); - VERBOSE(1, "ScoreProducer: " << scoreProducer->GetScoreProducerDescription() << " start: " << start << " end: " << end << endl); + VERBOSE(1, "FeatureFunction: " << scoreProducer->GetScoreProducerDescription() << " start: " << start << " end: " << end << endl); s_scoreIndexes[scoreProducer] = pair<size_t,size_t>(start,end); s_denseVectorSize = end; } void ScoreComponentCollection::UnregisterScoreProducer - (const ScoreProducer* scoreProducer) + (const FeatureFunction* scoreProducer) { - CHECK(scoreProducer->GetNumScoreComponents() != ScoreProducer::unlimited); + CHECK(scoreProducer->GetNumScoreComponents() != FeatureFunction::unlimited); ScoreIndexMap::iterator iter = s_scoreIndexes.find(scoreProducer); CHECK(iter != s_scoreIndexes.end()); s_scoreIndexes.erase(iter); @@ -61,8 +61,8 @@ void ScoreComponentCollection::MultiplyEquals(float scalar) } // Multiply all weights of this sparse producer by a given scalar -void ScoreComponentCollection::MultiplyEquals(const ScoreProducer* sp, float scalar) { - assert(sp->GetNumScoreComponents() == ScoreProducer::unlimited); +void ScoreComponentCollection::MultiplyEquals(const FeatureFunction* sp, float scalar) { + assert(sp->GetNumScoreComponents() == FeatureFunction::unlimited); std::string prefix = sp->GetScoreProducerDescription() + FName::SEP; for(FVector::FNVmap::const_iterator i = m_scores.cbegin(); i != m_scores.cend(); i++) { std::stringstream name; @@ -73,8 +73,8 @@ void ScoreComponentCollection::MultiplyEquals(const ScoreProducer* sp, float sca } // Count weights belonging to this sparse producer -size_t ScoreComponentCollection::GetNumberWeights(const ScoreProducer* sp) { - assert(sp->GetNumScoreComponents() == ScoreProducer::unlimited); +size_t ScoreComponentCollection::GetNumberWeights(const FeatureFunction* sp) { + assert(sp->GetNumScoreComponents() == FeatureFunction::unlimited); std::string prefix = sp->GetScoreProducerDescription() + FName::SEP; size_t weights = 0; for(FVector::FNVmap::const_iterator i = m_scores.cbegin(); i != m_scores.cend(); i++) { @@ -184,8 +184,8 @@ void ScoreComponentCollection::Save(const string& filename) const { out.close(); } -void ScoreComponentCollection::Assign(const ScoreProducer* sp, const string line) { - CHECK(sp->GetNumScoreComponents() == ScoreProducer::unlimited); +void ScoreComponentCollection::Assign(const FeatureFunction* sp, const string line) { + CHECK(sp->GetNumScoreComponents() == FeatureFunction::unlimited); istringstream istr(line); while(istr) { string namestring; diff --git a/moses/ScoreComponentCollection.h b/moses/ScoreComponentCollection.h index be23e03fd..772422b71 100644 --- a/moses/ScoreComponentCollection.h +++ b/moses/ScoreComponentCollection.h @@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "util/check.hh" #include "LMList.h" -#include "ScoreProducer.h" +#include "FeatureFunction.h" #include "FeatureVector.h" #include "TypeDef.h" #include "Util.h" @@ -67,17 +67,17 @@ class ScoreComponentCollection private: FVector m_scores; typedef std::pair<size_t,size_t> IndexPair; - typedef std::map<const ScoreProducer*,IndexPair> ScoreIndexMap; + typedef std::map<const FeatureFunction*,IndexPair> ScoreIndexMap; static ScoreIndexMap s_scoreIndexes; static size_t s_denseVectorSize; - static IndexPair GetIndexes(const ScoreProducer* sp) + static IndexPair GetIndexes(const FeatureFunction* sp) { ScoreIndexMap::const_iterator indexIter = s_scoreIndexes.find(sp); if (indexIter == s_scoreIndexes.end()) { - std::cerr << "ERROR: ScoreProducer: " << sp->GetScoreProducerDescription() << + std::cerr << "ERROR: FeatureFunction: " << sp->GetScoreProducerDescription() << " not registered with ScoreIndexMap" << std::endl; std::cerr << "You must call ScoreComponentCollection.RegisterScoreProducer() " << - " for every ScoreProducer" << std::endl; + " for every FeatureFunction" << std::endl; abort(); } return indexIter->second; @@ -105,8 +105,8 @@ public: * Register a ScoreProducer with a fixed number of scores, so that it can * be allocated space in the dense part of the feature vector. **/ - static void RegisterScoreProducer(const ScoreProducer* scoreProducer); - static void UnregisterScoreProducer(const ScoreProducer* scoreProducer); + static void RegisterScoreProducer(const FeatureFunction* scoreProducer); + static void UnregisterScoreProducer(const FeatureFunction* scoreProducer); /** Load from file */ bool Load(const std::string& filename) @@ -159,9 +159,9 @@ public: void MultiplyEquals(const ScoreComponentCollection& rhs); void MultiplyEqualsBackoff(const ScoreComponentCollection& rhs, float backoff); void MultiplyEquals(float core_r0, float sparse_r0); - void MultiplyEquals(const ScoreProducer* sp, float scalar); + void MultiplyEquals(const FeatureFunction* sp, float scalar); - size_t GetNumberWeights(const ScoreProducer* sp); + size_t GetNumberWeights(const FeatureFunction* sp); void CoreAssign(const ScoreComponentCollection& rhs) { @@ -192,9 +192,9 @@ public: } //For features which have an unbounded number of components - void MinusEquals(const ScoreProducer*sp, const std::string& name, float score) + void MinusEquals(const FeatureFunction*sp, const std::string& name, float score) { - assert(sp->GetNumScoreComponents() == ScoreProducer::unlimited); + assert(sp->GetNumScoreComponents() == FeatureFunction::unlimited); FName fname(sp->GetScoreProducerDescription(),name); m_scores[fname] -= score; } @@ -209,7 +209,7 @@ public: //! Add scores from a single ScoreProducer only //! The length of scores must be equal to the number of score components //! produced by sp - void PlusEquals(const ScoreProducer* sp, const ScoreComponentCollection& scores) + void PlusEquals(const FeatureFunction* sp, const ScoreComponentCollection& scores) { IndexPair indexes = GetIndexes(sp); for (size_t i = indexes.first; i < indexes.second; ++i) { @@ -217,10 +217,10 @@ public: } } - //! Add scores from a single ScoreProducer only + //! Add scores from a single FeatureFunction only //! The length of scores must be equal to the number of score components //! produced by sp - void PlusEquals(const ScoreProducer* sp, const std::vector<float>& scores) + void PlusEquals(const FeatureFunction* sp, const std::vector<float>& scores) { IndexPair indexes = GetIndexes(sp); CHECK(scores.size() == indexes.second - indexes.first); @@ -232,7 +232,7 @@ public: //! Special version PlusEquals(ScoreProducer, vector<float>) //! to add the score from a single ScoreProducer that produces //! a single value - void PlusEquals(const ScoreProducer* sp, float score) + void PlusEquals(const FeatureFunction* sp, float score) { IndexPair indexes = GetIndexes(sp); CHECK(1 == indexes.second - indexes.first); @@ -240,9 +240,9 @@ public: } //For features which have an unbounded number of components - void PlusEquals(const ScoreProducer*sp, const std::string& name, float score) + void PlusEquals(const FeatureFunction*sp, const std::string& name, float score) { - CHECK(sp->GetNumScoreComponents() == ScoreProducer::unlimited); + CHECK(sp->GetNumScoreComponents() == FeatureFunction::unlimited); FName fname(sp->GetScoreProducerDescription(),name); m_scores[fname] += score; } @@ -254,7 +254,7 @@ public: m_scores[fname] += score; } - void Assign(const ScoreProducer* sp, const std::vector<float>& scores) + void Assign(const FeatureFunction* sp, const std::vector<float>& scores) { IndexPair indexes = GetIndexes(sp); CHECK(scores.size() == indexes.second - indexes.first); @@ -266,7 +266,7 @@ public: //! Special version Assign(ScoreProducer, vector<float>) //! to add the score from a single ScoreProducer that produces //! a single value - void Assign(const ScoreProducer* sp, float score) + void Assign(const FeatureFunction* sp, float score) { IndexPair indexes = GetIndexes(sp); CHECK(1 == indexes.second - indexes.first); @@ -279,16 +279,16 @@ public: } //For features which have an unbounded number of components - void Assign(const ScoreProducer*sp, const std::string name, float score) + void Assign(const FeatureFunction*sp, const std::string name, float score) { - CHECK(sp->GetNumScoreComponents() == ScoreProducer::unlimited); + CHECK(sp->GetNumScoreComponents() == FeatureFunction::unlimited); FName fname(sp->GetScoreProducerDescription(),name); m_scores[fname] = score; } //Read sparse features from string - void Assign(const ScoreProducer* sp, const std::string line); + void Assign(const FeatureFunction* sp, const std::string line); // shortcut: setting the value directly using the feature name void Assign(const std::string name, float score) @@ -302,18 +302,18 @@ public: return m_scores.inner_product(rhs.m_scores); } - float PartialInnerProduct(const ScoreProducer* sp, const std::vector<float>& rhs) const + float PartialInnerProduct(const FeatureFunction* sp, const std::vector<float>& rhs) const { std::vector<float> lhs = GetScoresForProducer(sp); CHECK(lhs.size() == rhs.size()); return std::inner_product(lhs.begin(), lhs.end(), rhs.begin(), 0.0f); } - //! return a vector of all the scores associated with a certain ScoreProducer - std::vector<float> GetScoresForProducer(const ScoreProducer* sp) const + //! return a vector of all the scores associated with a certain FeatureFunction + std::vector<float> GetScoresForProducer(const FeatureFunction* sp) const { size_t components = sp->GetNumScoreComponents(); - if (components == ScoreProducer::unlimited) return std::vector<float>(); + if (components == FeatureFunction::unlimited) return std::vector<float>(); std::vector<float> res(components); IndexPair indexes = GetIndexes(sp); for (size_t i = 0; i < res.size(); ++i) { @@ -323,7 +323,7 @@ public: } //! get subset of scores that belong to a certain sparse ScoreProducer - FVector GetVectorForProducer(const ScoreProducer* sp) const + FVector GetVectorForProducer(const FeatureFunction* sp) const { FVector fv(s_denseVectorSize); std::string prefix = sp->GetScoreProducerDescription() + FName::SEP; @@ -365,9 +365,9 @@ public: m_scores.capMin(minValue); } - //! if a ScoreProducer produces a single score (for example, a language model score) + //! if a FeatureFunction produces a single score (for example, a language model score) //! this will return it. If not, this method will throw - float GetScoreForProducer(const ScoreProducer* sp) const + float GetScoreForProducer(const FeatureFunction* sp) const { IndexPair indexes = GetIndexes(sp); CHECK(indexes.second - indexes.first == 1); @@ -376,9 +376,9 @@ public: //For features which have an unbounded number of components float GetScoreForProducer - (const ScoreProducer* sp, const std::string& name) const + (const FeatureFunction* sp, const std::string& name) const { - CHECK(sp->GetNumScoreComponents() == ScoreProducer::unlimited); + CHECK(sp->GetNumScoreComponents() == FeatureFunction::unlimited); FName fname(sp->GetScoreProducerDescription(),name); return m_scores[fname]; } diff --git a/moses/ScoreComponentCollectionTest.cpp b/moses/ScoreComponentCollectionTest.cpp index 4af1c4544..110021ca5 100644 --- a/moses/ScoreComponentCollectionTest.cpp +++ b/moses/ScoreComponentCollectionTest.cpp @@ -50,7 +50,7 @@ class MockMultiFeature : public MockStatelessFeatureFunction { class MockSparseFeature : public MockStatelessFeatureFunction { public: - MockSparseFeature(): MockStatelessFeatureFunction("MockSparse", ScoreProducer::unlimited, "MockSparse") {} + MockSparseFeature(): MockStatelessFeatureFunction("MockSparse", FeatureFunction::unlimited, "MockSparse") {} }; diff --git a/moses/ScoreProducer.cpp b/moses/ScoreProducer.cpp deleted file mode 100644 index 77632713e..000000000 --- a/moses/ScoreProducer.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// $Id$ - -#include <iostream> -#include <sstream> - -#include "ScoreComponentCollection.h" -#include "ScoreProducer.h" - -using namespace std; - -namespace Moses -{ - -multiset<string> ScoreProducer::description_counts; -const size_t ScoreProducer::unlimited = -1; - -ScoreProducer::ScoreProducer(const std::string& description, const std::string &line) -: m_reportSparseFeatures(false) -{ - ParseLine(description, line); - m_numScoreComponents = FindNumFeatures(); - size_t index = description_counts.count(description); - - ostringstream dstream; - dstream << description; - dstream << index; - - description_counts.insert(description); - - m_description = dstream.str(); - if (m_numScoreComponents != unlimited) - { - ScoreComponentCollection::RegisterScoreProducer(this); - } -} - -ScoreProducer::ScoreProducer(const std::string& description, size_t numScoreComponents, const std::string &line) - : m_reportSparseFeatures(false), m_numScoreComponents(numScoreComponents) -{ - ParseLine(description, line); - size_t index = description_counts.count(description); - - ostringstream dstream; - dstream << description; - dstream << index; - - description_counts.insert(description); - - m_description = dstream.str(); - if (numScoreComponents != unlimited) - { - ScoreComponentCollection::RegisterScoreProducer(this); - } -} - -ScoreProducer::~ScoreProducer() -{ - cerr << endl << "In ~ScoreProducer of" << this << endl; -} - -void ScoreProducer::ParseLine(const std::string& description, const std::string &line) -{ - cerr << "line=" << line << endl; - vector<string> toks = Tokenize(line); - - CHECK(toks.size()); - //CHECK(toks[0] == description); - - for (size_t i = 1; i < toks.size(); ++i) { - vector<string> args = Tokenize(toks[i], "="); - CHECK(args.size() == 2); - m_args.push_back(args); - } -} - -size_t ScoreProducer::FindNumFeatures() -{ - for (size_t i = 0; i < m_args.size(); ++i) { - if (m_args[i][0] == "num-features") { - size_t ret = Scan<size_t>(m_args[i][1]); - m_args.erase(m_args.begin() + i); - return ret; - } - } - abort(); -} -} // namespace - - diff --git a/moses/ScoreProducer.h b/moses/ScoreProducer.h deleted file mode 100644 index 6b19f48ab..000000000 --- a/moses/ScoreProducer.h +++ /dev/null @@ -1,80 +0,0 @@ -// $Id$ - -#ifndef moses_ScoreProducer_h -#define moses_ScoreProducer_h - -#include <set> -#include <string> -#include <vector> - -#include "FeatureVector.h" - -namespace Moses -{ -class InputType; - - /* - * @note do not confuse this with a producer/consumer pattern. - * this is not a producer in that sense. - */ -class ScoreProducer -{ -protected: - std::string m_description, m_argLine; - std::vector<std::vector<std::string> > m_args; - bool m_reportSparseFeatures; - size_t m_numScoreComponents; - //In case there's multiple producers with the same description - static std::multiset<std::string> description_counts; - - ScoreProducer(const ScoreProducer&); // don't implement - ScoreProducer(const std::string& description, const std::string &line); - ScoreProducer(const std::string& description, size_t numScoreComponents, const std::string &line); - - void ParseLine(const std::string& description, const std::string &line); - size_t FindNumFeatures(); - -public: - - static const size_t unlimited; - - static void ResetDescriptionCounts() { - description_counts.clear(); - } - - virtual ~ScoreProducer(); - - //! returns the number of scores that a subclass produces. - //! For example, a language model conventionally produces 1, a translation table some arbitrary number, etc - //! sparse features returned unlimited - size_t GetNumScoreComponents() const {return m_numScoreComponents;} - - //! returns a string description of this producer - const std::string& GetScoreProducerDescription() const - { return m_description; } - - virtual bool IsStateless() const = 0; - - void SetSparseFeatureReporting() { m_reportSparseFeatures = true; } - bool GetSparseFeatureReporting() const { return m_reportSparseFeatures; } - - virtual float GetSparseProducerWeight() const { return 1; } - - virtual bool IsTuneable() const { return true; } - - //! - virtual void InitializeForInput(InputType const& source) - {} - - // clean up temporary memory, called after processing each sentence - virtual void CleanUpAfterSentenceProcessing(const InputType& source) - {} - - const std::string &GetArgLine() const - { return m_argLine; } -}; - - -} - -#endif diff --git a/moses/SourceWordDeletionFeature.cpp b/moses/SourceWordDeletionFeature.cpp index b6b2958ae..7079d4c2f 100644 --- a/moses/SourceWordDeletionFeature.cpp +++ b/moses/SourceWordDeletionFeature.cpp @@ -14,7 +14,7 @@ namespace Moses { using namespace std; SourceWordDeletionFeature::SourceWordDeletionFeature(const std::string &line) -:StatelessFeatureFunction("swd", ScoreProducer::unlimited, line), +:StatelessFeatureFunction("swd", FeatureFunction::unlimited, line), m_unrestricted(true) { std::cerr << "Initializing source word deletion feature.." << std::endl; diff --git a/moses/SparsePhraseDictionaryFeature.cpp b/moses/SparsePhraseDictionaryFeature.cpp index a37a5decb..f3b72d081 100644 --- a/moses/SparsePhraseDictionaryFeature.cpp +++ b/moses/SparsePhraseDictionaryFeature.cpp @@ -5,7 +5,7 @@ namespace Moses { SparsePhraseDictionaryFeature::SparsePhraseDictionaryFeature(const std::string &line) -:StatelessFeatureFunction("SparsePhraseDictionaryFeature", ScoreProducer::unlimited, line) +:StatelessFeatureFunction("SparsePhraseDictionaryFeature", FeatureFunction::unlimited, line) { } diff --git a/moses/StaticData.cpp b/moses/StaticData.cpp index fd6c2e810..84bff5d3d 100644 --- a/moses/StaticData.cpp +++ b/moses/StaticData.cpp @@ -742,13 +742,13 @@ void StaticData::SetBooleanParameter( bool *parameter, string parameterName, boo } } -void StaticData::SetWeight(const ScoreProducer* sp, float weight) +void StaticData::SetWeight(const FeatureFunction* sp, float weight) { m_allWeights.Resize(); m_allWeights.Assign(sp,weight); } -void StaticData::SetWeights(const ScoreProducer* sp, const std::vector<float>& weights) +void StaticData::SetWeights(const FeatureFunction* sp, const std::vector<float>& weights) { m_allWeights.Resize(); m_allWeights.Assign(sp,weights); @@ -757,7 +757,7 @@ void StaticData::SetWeights(const ScoreProducer* sp, const std::vector<float>& w StaticData::~StaticData() { /* - const std::vector<ScoreProducer*> &producers = FeatureFunction::GetFeatureFunctions(); + const std::vector<FeatureFunction*> &producers = FeatureFunction::GetFeatureFunctions(); for(size_t i=0;i<producers.size();++i) { ScoreProducer *ff = producers[i]; cerr << endl << "Destroying" << ff << endl; diff --git a/moses/StaticData.h b/moses/StaticData.h index fea966df2..464f26f57 100644 --- a/moses/StaticData.h +++ b/moses/StaticData.h @@ -415,7 +415,7 @@ public: return m_outputWordGraph; } - //! Sets the global score vector weights for a given ScoreProducer. + //! Sets the global score vector weights for a given FeatureFunction. InputTypeEnum GetInputType() const { return m_inputType; } @@ -457,16 +457,16 @@ public: } //Weight for a single-valued feature - float GetWeight(const ScoreProducer* sp) const { + float GetWeight(const FeatureFunction* sp) const { return m_allWeights.GetScoreForProducer(sp); } //Weight for a single-valued feature - void SetWeight(const ScoreProducer* sp, float weight) ; + void SetWeight(const FeatureFunction* sp, float weight) ; //Weights for feature with fixed number of values - std::vector<float> GetWeights(const ScoreProducer* sp) const { + std::vector<float> GetWeights(const FeatureFunction* sp) const { return m_allWeights.GetScoresForProducer(sp); } @@ -475,7 +475,7 @@ public: } //Weights for feature with fixed number of values - void SetWeights(const ScoreProducer* sp, const std::vector<float>& weights); + void SetWeights(const FeatureFunction* sp, const std::vector<float>& weights); bool GetDistinctNBest() const { return m_onlyDistinctNBest; diff --git a/moses/TargetBigramFeature.cpp b/moses/TargetBigramFeature.cpp index c267b9f76..189446a4f 100644 --- a/moses/TargetBigramFeature.cpp +++ b/moses/TargetBigramFeature.cpp @@ -14,7 +14,7 @@ int TargetBigramState::Compare(const FFState& other) const { } TargetBigramFeature::TargetBigramFeature(const std::string &line) -:StatefulFeatureFunction("TargetBigramFeature", ScoreProducer::unlimited, line) +:StatefulFeatureFunction("TargetBigramFeature", FeatureFunction::unlimited, line) { std::cerr << "Initializing target bigram feature.." << std::endl; diff --git a/moses/TargetNgramFeature.cpp b/moses/TargetNgramFeature.cpp index 5afb66837..50361f847 100644 --- a/moses/TargetNgramFeature.cpp +++ b/moses/TargetNgramFeature.cpp @@ -36,7 +36,7 @@ int TargetNgramState::Compare(const FFState& other) const { } TargetNgramFeature::TargetNgramFeature(const std::string &line) -:StatefulFeatureFunction("TargetNgramFeature", ScoreProducer::unlimited, line) +:StatefulFeatureFunction("TargetNgramFeature", FeatureFunction::unlimited, line) ,m_sparseProducerWeight(1) { std::cerr << "Initializing target ngram feature.." << std::endl; diff --git a/moses/TargetPhrase.cpp b/moses/TargetPhrase.cpp index 40d152379..50141a85a 100644 --- a/moses/TargetPhrase.cpp +++ b/moses/TargetPhrase.cpp @@ -92,7 +92,7 @@ void TargetPhrase::SetScore(float score) //we use an existing score producer to figure out information for score setting (number of scores and weights) //TODO: is this a good idea? const StaticData &staticData = StaticData::Instance(); - const ScoreProducer* prod = staticData.GetPhraseDictionaries()[0]; + const FeatureFunction* prod = staticData.GetPhraseDictionaries()[0]; vector<float> weights = staticData.GetWeights(prod); @@ -117,7 +117,7 @@ void TargetPhrase::SetScore(const TranslationSystem* system, const Scores &score { //we use an existing score producer to figure out information for score setting (number of scores and weights) const StaticData &staticData = StaticData::Instance(); - const ScoreProducer* prod = staticData.GetPhraseDictionaries()[0]; + const FeatureFunction* prod = staticData.GetPhraseDictionaries()[0]; vector<float> weights = StaticData::Instance().GetWeights(prod); @@ -130,7 +130,7 @@ void TargetPhrase::SetScore(const TranslationSystem* system, const Scores &score SetScore(prod,sizedScoreVector, ScoreComponentCollection(),weights,StaticData::Instance().GetWeightWordPenalty(),lmList); } -void TargetPhrase::SetScore(const ScoreProducer* translationScoreProducer, +void TargetPhrase::SetScore(const FeatureFunction* translationScoreProducer, const Scores &scoreVector, const ScoreComponentCollection &sparseScoreVector, const vector<float> &weightT, @@ -183,7 +183,7 @@ void TargetPhrase::SetScore(const ScoreProducer* translationScoreProducer, - (this->GetSize() * weightWP); // word penalty } -void TargetPhrase::SetScoreChart(const ScoreProducer* translationScoreProducer, +void TargetPhrase::SetScoreChart(const FeatureFunction* translationScoreProducer, const Scores &scoreVector ,const vector<float> &weightT ,const LMList &languageModels @@ -237,7 +237,7 @@ void TargetPhrase::SetScoreChart(const ScoreProducer* translationScoreProducer, m_fullScore = m_scoreBreakdown.GetWeightedScore() - totalNgramScore + totalFullScore + totalOOVScore; } -void TargetPhrase::SetScore(const ScoreProducer* producer, const Scores &scoreVector) +void TargetPhrase::SetScore(const FeatureFunction* producer, const Scores &scoreVector) { // used when creating translations of unknown words (chart decoding) m_scoreBreakdown.Assign(producer, scoreVector); @@ -245,7 +245,7 @@ void TargetPhrase::SetScore(const ScoreProducer* producer, const Scores &scoreVe } -void TargetPhrase::SetWeights(const ScoreProducer* translationScoreProducer, const vector<float> &weightT) +void TargetPhrase::SetWeights(const FeatureFunction* translationScoreProducer, const vector<float> &weightT) { // calling this function in case of confusion net input is undefined CHECK(StaticData::Instance().GetInputType()==SentenceInput); diff --git a/moses/TargetPhrase.h b/moses/TargetPhrase.h index 030841327..0699a63d3 100644 --- a/moses/TargetPhrase.h +++ b/moses/TargetPhrase.h @@ -38,7 +38,7 @@ namespace Moses { class LMList; -class ScoreProducer; +class FeatureFunction; class TranslationSystem; class WordPenaltyProducer; @@ -83,26 +83,26 @@ public: * * @TODO should this be part of the constructor? If not, add explanation why not. */ - void SetScore(const ScoreProducer* translationScoreProducer, + void SetScore(const FeatureFunction* translationScoreProducer, const Scores &scoreVector, const ScoreComponentCollection &sparseScoreVector, const std::vector<float> &weightT, float weightWP, const LMList &languageModels); - void SetScoreChart(const ScoreProducer* translationScoreProducer + void SetScoreChart(const FeatureFunction* translationScoreProducer ,const Scores &scoreVector ,const std::vector<float> &weightT ,const LMList &languageModels ,const WordPenaltyProducer* wpProducer); // used by for unknown word proc in chart decoding - void SetScore(const ScoreProducer* producer, const Scores &scoreVector); + void SetScore(const FeatureFunction* producer, const Scores &scoreVector); // used when creating translations of unknown words: void ResetScore(); - void SetWeights(const ScoreProducer*, const std::vector<float> &weightT); + void SetWeights(const FeatureFunction*, const std::vector<float> &weightT); TargetPhrase *MergeNext(const TargetPhrase &targetPhrase) const; // used for translation step diff --git a/moses/TargetWordInsertionFeature.cpp b/moses/TargetWordInsertionFeature.cpp index 3a6b81eef..f61b81a1e 100644 --- a/moses/TargetWordInsertionFeature.cpp +++ b/moses/TargetWordInsertionFeature.cpp @@ -13,7 +13,7 @@ namespace Moses { using namespace std; TargetWordInsertionFeature::TargetWordInsertionFeature(const std::string &line) -:StatelessFeatureFunction("twi", ScoreProducer::unlimited, line), +:StatelessFeatureFunction("twi", FeatureFunction::unlimited, line), m_unrestricted(true) { std::cerr << "Initializing target word insertion feature.." << std::endl; diff --git a/moses/TranslationOption.cpp b/moses/TranslationOption.cpp index 2d273fe06..6c8781caf 100644 --- a/moses/TranslationOption.cpp +++ b/moses/TranslationOption.cpp @@ -53,7 +53,7 @@ TranslationOption::TranslationOption(const WordsRange &wordsRange , m_futureScore(0) { if (up) { - const ScoreProducer *scoreProducer = (const ScoreProducer *)up; // not sure why none of the c++ cast works + const FeatureFunction *scoreProducer = (const FeatureFunction *)up; // not sure why none of the c++ cast works vector<float> score(1); score[0] = FloorScore(-numeric_limits<float>::infinity()); m_scoreBreakdown.Assign(scoreProducer, score); @@ -131,7 +131,7 @@ ostream& operator<<(ostream& out, const TranslationOption& possibleTranslation) return out; } -void TranslationOption::CacheScores(const ScoreProducer &producer, const Scores &score) +void TranslationOption::CacheScores(const FeatureFunction &producer, const Scores &score) { m_cachedScores[&producer] = score; } diff --git a/moses/TranslationOption.h b/moses/TranslationOption.h index 89ebdc05b..54b2bb6fb 100644 --- a/moses/TranslationOption.h +++ b/moses/TranslationOption.h @@ -73,7 +73,7 @@ protected: //! possible to estimate, it is included here. ScoreComponentCollection m_scoreBreakdown; - typedef std::map<const ScoreProducer *, Scores> _ScoreCacheMap; + typedef std::map<const FeatureFunction *, Scores> _ScoreCacheMap; _ScoreCacheMap m_cachedScores; public: @@ -146,7 +146,7 @@ public: } /** returns cached scores */ - inline const Scores *GetCachedScores(const ScoreProducer *scoreProducer) const { + inline const Scores *GetCachedScores(const FeatureFunction *scoreProducer) const { _ScoreCacheMap::const_iterator it = m_cachedScores.find(scoreProducer); if(it == m_cachedScores.end()) return NULL; @@ -157,7 +157,7 @@ public: /** Calculate future score and n-gram score of this trans option, plus the score breakdowns */ void CalcScore(const TranslationSystem* system); - void CacheScores(const ScoreProducer &scoreProducer, const Scores &score); + void CacheScores(const FeatureFunction &scoreProducer, const Scores &score); TO_STRING(); diff --git a/moses/WordTranslationFeature.cpp b/moses/WordTranslationFeature.cpp index 95f822417..51249cefc 100644 --- a/moses/WordTranslationFeature.cpp +++ b/moses/WordTranslationFeature.cpp @@ -15,7 +15,7 @@ namespace Moses { using namespace std; WordTranslationFeature::WordTranslationFeature(const std::string &line) -:StatelessFeatureFunction("WordTranslationFeature", ScoreProducer::unlimited, line) +:StatelessFeatureFunction("WordTranslationFeature", FeatureFunction::unlimited, line) ,m_unrestricted(true) ,m_sparseProducerWeight(1) ,m_simple(true) |