diff options
author | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2010-09-15 20:02:41 +0400 |
---|---|---|
committer | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2010-09-15 20:02:41 +0400 |
commit | 9aeca75bda7052163359387fe053bcf5cc99c32d (patch) | |
tree | 65a551995d7a3f988c328608a52abc7cdefff3c2 | |
parent | d5710c5e2297e71c56bf74a77c2c681513f716cf (diff) |
get rid of weight in LM classmira-mtm5_on-the-fly_paramater_updates_working
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/tags/mira-mtm5_on-the-fly_paramater_updates_working@3466 1f5c12ca-751b-0410-a591-d2e778427230
-rw-r--r-- | moses/moses.xcodeproj/project.pbxproj | 8 | ||||
-rw-r--r-- | moses/src/LanguageModel.cpp | 6 | ||||
-rw-r--r-- | moses/src/LanguageModel.h | 14 | ||||
-rw-r--r-- | moses/src/StaticData.cpp | 9 |
4 files changed, 16 insertions, 21 deletions
diff --git a/moses/moses.xcodeproj/project.pbxproj b/moses/moses.xcodeproj/project.pbxproj index 4b1976e8e..47e8bab96 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 = "<group>"; }; 1E059676123FB1E900D39289 /* OnlineCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OnlineCommand.h; path = src/OnlineCommand.h; sourceTree = "<group>"; }; + 1E20EFEE1241211A00D7FE95 /* BleuScoreFeature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BleuScoreFeature.cpp; path = src/BleuScoreFeature.cpp; sourceTree = "<group>"; }; + 1E20EFEF1241211A00D7FE95 /* BleuScoreFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BleuScoreFeature.h; path = src/BleuScoreFeature.h; sourceTree = "<group>"; }; 1E5D8E0211F25F03000F027F /* PhraseDictionaryNodeSCFG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseDictionaryNodeSCFG.cpp; path = src/PhraseDictionaryNodeSCFG.cpp; sourceTree = "<group>"; }; 1E5D8E0311F25F03000F027F /* PhraseDictionaryNodeSCFG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhraseDictionaryNodeSCFG.h; path = src/PhraseDictionaryNodeSCFG.h; sourceTree = "<group>"; }; 1E5D8E0611F25F2F000F027F /* PhraseDictionarySCFG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseDictionarySCFG.cpp; path = src/PhraseDictionarySCFG.cpp; sourceTree = "<group>"; }; @@ -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 80432140f..930016c6e 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 9d444ac8e..965591add 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 @@ public: { return m_nGramOrder; } - + float GetWeight() const; + //! Contains factors which represents the beging and end words for this LM. Usually <s> and </s> const Word &GetSentenceStartArray() const { @@ -120,16 +120,6 @@ public: 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 280c050ae..e19c38bf6 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++]); - } } } |