diff --git a/moses/moses.xcodeproj/project.pbxproj b/moses/moses.xcodeproj/project.pbxproj index 4b1976e8e0..47e8bab96c 100644 --- a/moses/moses.xcodeproj/project.pbxproj +++ b/moses/moses.xcodeproj/project.pbxproj @@ -9,6 +9,8 @@ /* Begin PBXBuildFile section */ 1E059677123FB1E900D39289 /* OnlineCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E059675123FB1E900D39289 /* OnlineCommand.cpp */; }; 1E059678123FB1E900D39289 /* OnlineCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E059676123FB1E900D39289 /* OnlineCommand.h */; }; + 1E20EFF01241211A00D7FE95 /* BleuScoreFeature.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E20EFEE1241211A00D7FE95 /* BleuScoreFeature.cpp */; }; + 1E20EFF11241211A00D7FE95 /* BleuScoreFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E20EFEF1241211A00D7FE95 /* BleuScoreFeature.h */; }; 1E5D8E0411F25F03000F027F /* PhraseDictionaryNodeSCFG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E5D8E0211F25F03000F027F /* PhraseDictionaryNodeSCFG.cpp */; }; 1E5D8E0511F25F03000F027F /* PhraseDictionaryNodeSCFG.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E5D8E0311F25F03000F027F /* PhraseDictionaryNodeSCFG.h */; }; 1E5D8E0811F25F2F000F027F /* PhraseDictionarySCFG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E5D8E0611F25F2F000F027F /* PhraseDictionarySCFG.cpp */; }; @@ -228,6 +230,8 @@ /* Begin PBXFileReference section */ 1E059675123FB1E900D39289 /* OnlineCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OnlineCommand.cpp; path = src/OnlineCommand.cpp; sourceTree = ""; }; 1E059676123FB1E900D39289 /* OnlineCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OnlineCommand.h; path = src/OnlineCommand.h; sourceTree = ""; }; + 1E20EFEE1241211A00D7FE95 /* BleuScoreFeature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BleuScoreFeature.cpp; path = src/BleuScoreFeature.cpp; sourceTree = ""; }; + 1E20EFEF1241211A00D7FE95 /* BleuScoreFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BleuScoreFeature.h; path = src/BleuScoreFeature.h; sourceTree = ""; }; 1E5D8E0211F25F03000F027F /* PhraseDictionaryNodeSCFG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseDictionaryNodeSCFG.cpp; path = src/PhraseDictionaryNodeSCFG.cpp; sourceTree = ""; }; 1E5D8E0311F25F03000F027F /* PhraseDictionaryNodeSCFG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhraseDictionaryNodeSCFG.h; path = src/PhraseDictionaryNodeSCFG.h; sourceTree = ""; }; 1E5D8E0611F25F2F000F027F /* PhraseDictionarySCFG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseDictionarySCFG.cpp; path = src/PhraseDictionarySCFG.cpp; sourceTree = ""; }; @@ -471,6 +475,8 @@ 08FB7795FE84155DC02AAC07 /* Source */ = { isa = PBXGroup; children = ( + 1E20EFEE1241211A00D7FE95 /* BleuScoreFeature.cpp */, + 1E20EFEF1241211A00D7FE95 /* BleuScoreFeature.h */, 1E059675123FB1E900D39289 /* OnlineCommand.cpp */, 1E059676123FB1E900D39289 /* OnlineCommand.h */, 1ED4FC5F11BDC0D2004E826A /* AlignmentInfo.cpp */, @@ -837,6 +843,7 @@ 1EF549BA12118A5D00C481EB /* TranslationSystem.h in Headers */, 1E7739D1123F646800B88EB7 /* FeatureVector.h in Headers */, 1E059678123FB1E900D39289 /* OnlineCommand.h in Headers */, + 1E20EFF11241211A00D7FE95 /* BleuScoreFeature.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -985,6 +992,7 @@ 1EF549B912118A5D00C481EB /* TranslationSystem.cpp in Sources */, 1E7739D0123F646800B88EB7 /* FeatureVector.cpp in Sources */, 1E059677123FB1E900D39289 /* OnlineCommand.cpp in Sources */, + 1E20EFF01241211A00D7FE95 /* BleuScoreFeature.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/moses/src/LanguageModel.cpp b/moses/src/LanguageModel.cpp index 80432140fd..930016c6ec 100644 --- a/moses/src/LanguageModel.cpp +++ b/moses/src/LanguageModel.cpp @@ -251,4 +251,10 @@ FFState* LanguageModel::Evaluate( return res; } +float LanguageModel::GetWeight() const { + size_t lmIndex = StaticData::Instance().GetScoreIndexManager(). + GetBeginIndex(GetScoreBookkeepingID()); + return StaticData::Instance().GetAllWeights()[lmIndex]; +} + } diff --git a/moses/src/LanguageModel.h b/moses/src/LanguageModel.h index 9d444ac8ee..965591add4 100644 --- a/moses/src/LanguageModel.h +++ b/moses/src/LanguageModel.h @@ -41,7 +41,6 @@ class Phrase; class LanguageModel : public StatefulFeatureFunction { protected: - float m_weight; //! scoring weight. Shouldn't this now be superceded by ScoreProducer??? std::string m_filePath; //! for debugging purposes size_t m_nGramOrder; //! max n-gram length contained in this LM Word m_sentenceStartArray, m_sentenceEndArray; //! Contains factors which represents the beging and end words for this LM. @@ -107,7 +106,8 @@ class LanguageModel : public StatefulFeatureFunction { return m_nGramOrder; } - + float GetWeight() const; + //! Contains factors which represents the beging and end words for this LM. Usually and const Word &GetSentenceStartArray() const { @@ -120,16 +120,6 @@ class LanguageModel : public StatefulFeatureFunction virtual std::string GetScoreProducerDescription() const = 0; - //! scoring weight. Shouldn't this now be superceded by ScoreProducer??? - float GetWeight() const - { - return m_weight; - } - void SetWeight(float weight) - { - m_weight = weight; - } - std::string GetScoreProducerWeightShortName() const { return "lm"; diff --git a/moses/src/StaticData.cpp b/moses/src/StaticData.cpp index 280c050ae2..e19c38bf60 100644 --- a/moses/src/StaticData.cpp +++ b/moses/src/StaticData.cpp @@ -1365,15 +1365,6 @@ void StaticData::ReLoadParameter() phraseDictionary.SetWeightTransModel(tmp_weights); } - const LMList &languageModels = transSystem.GetLanguageModels(); - LMList::const_iterator lmIter; - size_t index_WeightLM = 0; - for (lmIter = languageModels.begin(); lmIter != languageModels.end(); ++lmIter) - { - LanguageModel &lm = **lmIter; - - lm.SetWeight(WeightsLM[index_WeightLM++]); - } } }