delete references to LMList

This commit is contained in:
Hieu Hoang 2013-05-21 13:00:26 +01:00
parent 42ddc084b4
commit f4cf5f152b
17 changed files with 9 additions and 54 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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);

View File

@ -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;
}

View File

@ -22,7 +22,6 @@ public:
const std::string &inFile,
const std::vector<float> &weight,
size_t tableLimit,
const LMList &languageModels,
const WordPenaltyProducer* wpProducer,
RuleTableTrie &);

View File

@ -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)
{

View File

@ -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 &);
};

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -37,7 +37,6 @@ PhraseDictionaryOnDisk::~PhraseDictionaryOnDisk()
bool PhraseDictionaryOnDisk::InitDictionary()
{
const StaticData &staticData = StaticData::Instance();
m_languageModels = &staticData.GetLMList();
m_wpProducer = staticData.GetWordPenaltyProducer();
return true;

View File

@ -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();

View File

@ -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;
}

View File

@ -28,7 +28,6 @@
namespace Moses
{
class LMList;
class Phrase;
class TargetPhrase;
class TargetPhraseCollection;