diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-21 16:00:26 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-21 16:00:26 +0400 |
commit | f4cf5f152b3c3736236a99ff66a6b8148d81e745 (patch) | |
tree | b4373cfa1cadecf9b2de7dbe5037a0ba8a34a964 | |
parent | 42ddc084b4b6bff7697d48f4a879a7d93e3bb923 (diff) |
delete references to LMList
17 files changed, 9 insertions, 54 deletions
diff --git a/moses/ScoreComponentCollection.cpp b/moses/ScoreComponentCollection.cpp index b1b171465..c836ea5b3 100644 --- a/moses/ScoreComponentCollection.cpp +++ b/moses/ScoreComponentCollection.cpp @@ -32,20 +32,6 @@ float ScoreComponentCollection::GetWeightedScore() const return m_scores.inner_product(StaticData::Instance().GetAllWeights().m_scores); } -void ScoreComponentCollection::ZeroAllLM(const LMList& lmList) -{ - for (LMList::const_iterator i = lmList.begin(); i != lmList.end(); ++i) { - Assign(*i, 0); - } -} - -void ScoreComponentCollection::PlusEqualsAllLM(const LMList& lmList, const ScoreComponentCollection& rhs) -{ - for (LMList::const_iterator i = lmList.begin(); i != lmList.end(); ++i) { - PlusEquals(*i,rhs); - } -} - void ScoreComponentCollection::MultiplyEquals(float scalar) { m_scores *= scalar; diff --git a/moses/ScoreComponentCollection.h b/moses/ScoreComponentCollection.h index 2a8848136..afec0ab9d 100644 --- a/moses/ScoreComponentCollection.h +++ b/moses/ScoreComponentCollection.h @@ -32,7 +32,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "util/check.hh" -#include "LMList.h" #include "FeatureFunction.h" #include "FeatureVector.h" #include "TypeDef.h" @@ -377,8 +376,6 @@ public: float GetWeightedScore() const; void ZeroDenseFeatures(const FeatureFunction* sp); - void ZeroAllLM(const LMList& lmList); - void PlusEqualsAllLM(const LMList& lmList, const ScoreComponentCollection& rhs); void L1Normalise(); float GetL1Norm() const; float GetL2Norm() const; diff --git a/moses/TranslationModel/RuleTable/Loader.h b/moses/TranslationModel/RuleTable/Loader.h index 28c726dda..c3df65555 100644 --- a/moses/TranslationModel/RuleTable/Loader.h +++ b/moses/TranslationModel/RuleTable/Loader.h @@ -28,7 +28,6 @@ namespace Moses { -class LMList; class WordPenaltyProducer; /** Abstract base class defining RuleTableLoader interface. Friend of RuleTableTrie. @@ -43,7 +42,6 @@ class RuleTableLoader const std::string &inFile, const std::vector<float> &weight, size_t tableLimit, - const LMList &languageModels, const WordPenaltyProducer* wpProducer, RuleTableTrie &) = 0; diff --git a/moses/TranslationModel/RuleTable/LoaderCompact.cpp b/moses/TranslationModel/RuleTable/LoaderCompact.cpp index d2610291f..021d38c20 100644 --- a/moses/TranslationModel/RuleTable/LoaderCompact.cpp +++ b/moses/TranslationModel/RuleTable/LoaderCompact.cpp @@ -22,7 +22,6 @@ #include "moses/AlignmentInfoCollection.h" #include "moses/DummyScoreProducers.h" #include "moses/InputFileStream.h" -#include "moses/LMList.h" #include "moses/UserMessage.h" #include "moses/Util.h" #include "moses/Word.h" @@ -39,7 +38,6 @@ bool RuleTableLoaderCompact::Load(const std::vector<FactorType> &input, const std::string &inFile, const std::vector<float> &weight, size_t /* tableLimit */, - const LMList &languageModels, const WordPenaltyProducer* wpProducer, RuleTableTrie &ruleTable) { @@ -77,7 +75,7 @@ bool RuleTableLoaderCompact::Load(const std::vector<FactorType> &input, // Load rules. if (!LoadRuleSection(reader, vocab, sourcePhrases, targetPhrases, - targetLhsIds, alignmentSets, languageModels, + targetLhsIds, alignmentSets, wpProducer, weight, ruleTable)) { return false; } @@ -181,7 +179,6 @@ bool RuleTableLoaderCompact::LoadRuleSection( const std::vector<Phrase> &targetPhrases, const std::vector<size_t> &targetLhsIds, const std::vector<const AlignmentInfo *> &alignmentSets, - const LMList &languageModels, const WordPenaltyProducer *wpProducer, const std::vector<float> &weights, RuleTableTrie &ruleTable) diff --git a/moses/TranslationModel/RuleTable/LoaderCompact.h b/moses/TranslationModel/RuleTable/LoaderCompact.h index 865dd35f0..da892431e 100644 --- a/moses/TranslationModel/RuleTable/LoaderCompact.h +++ b/moses/TranslationModel/RuleTable/LoaderCompact.h @@ -30,8 +30,6 @@ namespace Moses { - -class LMList; class RuleTableTrie; class WordPenaltyProducer; @@ -44,7 +42,6 @@ class RuleTableLoaderCompact : public RuleTableLoader const std::string &inFile, const std::vector<float> &weight, size_t tableLimit, - const LMList &languageModels, const WordPenaltyProducer* wpProducer, RuleTableTrie &); @@ -80,7 +77,6 @@ class RuleTableLoaderCompact : public RuleTableLoader const std::vector<Phrase> &, const std::vector<size_t> &, const std::vector<const AlignmentInfo *> &, - const LMList &languageModels, const WordPenaltyProducer *wpProducer, const std::vector<float> &weights, RuleTableTrie &ruleTable); diff --git a/moses/TranslationModel/RuleTable/LoaderHiero.cpp b/moses/TranslationModel/RuleTable/LoaderHiero.cpp index 9f14b796d..6174ce1d7 100644 --- a/moses/TranslationModel/RuleTable/LoaderHiero.cpp +++ b/moses/TranslationModel/RuleTable/LoaderHiero.cpp @@ -18,14 +18,13 @@ bool RuleTableLoaderHiero::Load(const std::vector<FactorType> &input, const std::string &inFile, const std::vector<float> &weight, size_t tableLimit, - const LMList &languageModels, const WordPenaltyProducer* wpProducer, RuleTableTrie &ruleTable) { bool ret = RuleTableLoaderStandard::Load(HieroFormat ,input, output ,inFile, weight - ,tableLimit, languageModels + ,tableLimit ,wpProducer, ruleTable); return ret; } diff --git a/moses/TranslationModel/RuleTable/LoaderHiero.h b/moses/TranslationModel/RuleTable/LoaderHiero.h index 682e1ec20..a7afd53d1 100644 --- a/moses/TranslationModel/RuleTable/LoaderHiero.h +++ b/moses/TranslationModel/RuleTable/LoaderHiero.h @@ -22,7 +22,6 @@ public: const std::string &inFile, const std::vector<float> &weight, size_t tableLimit, - const LMList &languageModels, const WordPenaltyProducer* wpProducer, RuleTableTrie &); diff --git a/moses/TranslationModel/RuleTable/LoaderStandard.cpp b/moses/TranslationModel/RuleTable/LoaderStandard.cpp index 964670475..86285d0f9 100644 --- a/moses/TranslationModel/RuleTable/LoaderStandard.cpp +++ b/moses/TranslationModel/RuleTable/LoaderStandard.cpp @@ -50,14 +50,13 @@ bool RuleTableLoaderStandard::Load(const std::vector<FactorType> &input , const std::string &inFile , const std::vector<float> &weight , size_t tableLimit - , const LMList &languageModels , const WordPenaltyProducer* wpProducer , RuleTableTrie &ruleTable) { bool ret = Load(MosesFormat ,input, output ,inFile, weight - ,tableLimit, languageModels + ,tableLimit ,wpProducer, ruleTable); return ret; @@ -152,7 +151,6 @@ bool RuleTableLoaderStandard::Load(FormatType format , const std::string &inFile , const std::vector<float> &weight , size_t /* tableLimit */ - , const LMList &languageModels , const WordPenaltyProducer* wpProducer , RuleTableTrie &ruleTable) { diff --git a/moses/TranslationModel/RuleTable/LoaderStandard.h b/moses/TranslationModel/RuleTable/LoaderStandard.h index 36174a682..84837de07 100644 --- a/moses/TranslationModel/RuleTable/LoaderStandard.h +++ b/moses/TranslationModel/RuleTable/LoaderStandard.h @@ -35,7 +35,6 @@ protected: const std::string &inFile, const std::vector<float> &weight, size_t tableLimit, - const LMList &languageModels, const WordPenaltyProducer* wpProducer, RuleTableTrie &); public: @@ -44,7 +43,6 @@ protected: const std::string &inFile, const std::vector<float> &weight, size_t tableLimit, - const LMList &languageModels, const WordPenaltyProducer* wpProducer, RuleTableTrie &); }; diff --git a/moses/TranslationModel/RuleTable/PhraseDictionaryALSuffixArray.cpp b/moses/TranslationModel/RuleTable/PhraseDictionaryALSuffixArray.cpp index e03b37914..1b4e35191 100644 --- a/moses/TranslationModel/RuleTable/PhraseDictionaryALSuffixArray.cpp +++ b/moses/TranslationModel/RuleTable/PhraseDictionaryALSuffixArray.cpp @@ -26,7 +26,6 @@ bool PhraseDictionaryALSuffixArray::Load(const std::vector<FactorType> &input , const std::string &filePath , const std::vector<float> &weight , size_t tableLimit - , const LMList &languageModels , const WordPenaltyProducer* wpProducer) { const StaticData &staticData = StaticData::Instance(); @@ -42,7 +41,6 @@ bool PhraseDictionaryALSuffixArray::Load(const std::vector<FactorType> &input m_input = &input; m_output = &output; - m_languageModels = &languageModels; m_wpProducer = wpProducer; m_weight = &weight; @@ -63,7 +61,7 @@ void PhraseDictionaryALSuffixArray::InitializeForInput(InputType const& source) RuleTableLoaderFactory::Create(grammarFile); std::vector<float> weightT = StaticData::Instance().GetWeights(this); bool ret = loader->Load(*m_input, *m_output, grammarFile, weightT, m_tableLimit, - *m_languageModels, m_wpProducer, *this); + m_wpProducer, *this); CHECK(ret); } diff --git a/moses/TranslationModel/RuleTable/PhraseDictionaryALSuffixArray.h b/moses/TranslationModel/RuleTable/PhraseDictionaryALSuffixArray.h index 450f8fc46..3cb2022be 100644 --- a/moses/TranslationModel/RuleTable/PhraseDictionaryALSuffixArray.h +++ b/moses/TranslationModel/RuleTable/PhraseDictionaryALSuffixArray.h @@ -30,14 +30,12 @@ public: , const std::string &filePath , const std::vector<float> &weight , size_t tableLimit - , const LMList &languageModels , const WordPenaltyProducer* wpProducer); void InitializeForInput(InputType const& source); protected: const std::vector<FactorType> *m_input, *m_output; - const LMList *m_languageModels; const WordPenaltyProducer *m_wpProducer; const std::vector<float> *m_weight; diff --git a/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.cpp b/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.cpp index 453b34224..641ffff7f 100644 --- a/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.cpp +++ b/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.cpp @@ -57,11 +57,9 @@ namespace Moses , const std::vector<FactorType> &output , const std::string &initStr , const std::vector<float> &weight - , size_t tableLimit, - const LMList& languageModels, - const WordPenaltyProducer* wpProducer) + , size_t tableLimit + , const WordPenaltyProducer* wpProducer) { - m_languageModels = &(languageModels); m_wpProducer = wpProducer; m_tableLimit = tableLimit; m_input = &input; diff --git a/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.h b/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.h index 601da5976..e34728b8f 100644 --- a/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.h +++ b/moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.h @@ -45,9 +45,8 @@ namespace Moses , const std::vector<FactorType> &output , const std::string &initStr , const std::vector<float> &weight - , size_t tableLimit, - const LMList& languageModels, - const WordPenaltyProducer* wpProducer); + , size_t tableLimit + , const WordPenaltyProducer* wpProducer); const PhraseDictionaryNodeSCFG &GetRootNode(const InputType &source) const; @@ -83,7 +82,6 @@ namespace Moses std::vector<std::string> m_config; const std::vector<FactorType> *m_input, *m_output; - const LMList *m_languageModels; const WordPenaltyProducer *m_wpProducer; const std::vector<float> *m_weight; diff --git a/moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.cpp b/moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.cpp index 7f240d711..35c65fc38 100644 --- a/moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.cpp +++ b/moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.cpp @@ -37,7 +37,6 @@ PhraseDictionaryOnDisk::~PhraseDictionaryOnDisk() bool PhraseDictionaryOnDisk::InitDictionary() { const StaticData &staticData = StaticData::Instance(); - m_languageModels = &staticData.GetLMList(); m_wpProducer = staticData.GetWordPenaltyProducer(); return true; diff --git a/moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.h b/moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.h index 434a0da6c..eac112b71 100644 --- a/moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.h +++ b/moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.h @@ -45,7 +45,6 @@ class PhraseDictionaryOnDisk : public PhraseDictionary protected: boost::thread_specific_ptr<OnDiskPt::OnDiskWrapper> m_implementation; - const LMList* m_languageModels; const WordPenaltyProducer* m_wpProducer; OnDiskPt::OnDiskWrapper &GetImplementation(); @@ -54,7 +53,6 @@ protected: public: PhraseDictionaryOnDisk(const std::string &line) : MyBase("PhraseDictionaryOnDisk", line) - , m_languageModels(NULL) {} virtual ~PhraseDictionaryOnDisk(); diff --git a/moses/TranslationModel/RuleTable/Trie.cpp b/moses/TranslationModel/RuleTable/Trie.cpp index 7b6dfe070..6ed8d5532 100644 --- a/moses/TranslationModel/RuleTable/Trie.cpp +++ b/moses/TranslationModel/RuleTable/Trie.cpp @@ -47,10 +47,9 @@ bool RuleTableTrie::InitDictionary() vector<float> weight = staticData.GetWeights(this); const WordPenaltyProducer *wpProducer = staticData.GetWordPenaltyProducer(); - const LMList &languageModels = staticData.GetLMList(); bool ret = loader->Load(m_input, m_output, m_filePath, weight, m_tableLimit, - languageModels, wpProducer, *this); + wpProducer, *this); return ret; } diff --git a/moses/TranslationModel/RuleTable/Trie.h b/moses/TranslationModel/RuleTable/Trie.h index 3156a84ad..c0030a602 100644 --- a/moses/TranslationModel/RuleTable/Trie.h +++ b/moses/TranslationModel/RuleTable/Trie.h @@ -28,7 +28,6 @@ namespace Moses { -class LMList; class Phrase; class TargetPhrase; class TargetPhraseCollection; |