diff --git a/contrib/other-builds/moses2/FeatureFunctions.cpp b/contrib/other-builds/moses2/FeatureFunctions.cpp index 828230d3a..229c1cb4f 100644 --- a/contrib/other-builds/moses2/FeatureFunctions.cpp +++ b/contrib/other-builds/moses2/FeatureFunctions.cpp @@ -10,8 +10,9 @@ #include "StatefulFeatureFunction.h" #include "System.h" -#include "PhraseTable.h" +#include "SkeletonStatelessFF.h" #include "SkeletonStatefulFF.h" +#include "PhraseTable.h" using namespace std; @@ -83,7 +84,8 @@ FeatureFunction *FeatureFunctions::Create(const std::string &line) ret = new PhraseTable(m_ffStartInd, line); } else { - ret = new SkeletonStatefulFF(m_ffStartInd, line); + //ret = new SkeletonStatefulFF(m_ffStartInd, line); + ret = new SkeletonStatelessFF(m_ffStartInd, line); } m_ffStartInd += ret->GetNumScores(); diff --git a/contrib/other-builds/moses2/Hypothesis.cpp b/contrib/other-builds/moses2/Hypothesis.cpp index 24d4e20b7..c495a8114 100644 --- a/contrib/other-builds/moses2/Hypothesis.cpp +++ b/contrib/other-builds/moses2/Hypothesis.cpp @@ -21,7 +21,7 @@ Hypothesis::Hypothesis(Manager &mgr, ,m_range(range) ,m_prevHypo(NULL) { - util::Pool &pool = m_mgr.GetPool(); + MemPool &pool = m_mgr.GetPool(); size_t numStatefulFFs = m_mgr.GetSystem().GetFeatureFunctions().GetStatefulFeatureFunctions().size(); m_ffStates = (Moses::FFState **) pool.Allocate(sizeof(Moses::FFState*) * numStatefulFFs); @@ -39,7 +39,7 @@ Hypothesis::Hypothesis(const Hypothesis &prevHypo, ,m_range(pathRange) ,m_prevHypo(&prevHypo) { - util::Pool &pool = m_mgr.GetPool(); + MemPool &pool = m_mgr.GetPool(); size_t numStatefulFFs = m_mgr.GetSystem().GetFeatureFunctions().GetStatefulFeatureFunctions().size(); m_ffStates = (Moses::FFState **) pool.Allocate(sizeof(Moses::FFState*) * numStatefulFFs); diff --git a/contrib/other-builds/moses2/Jamfile b/contrib/other-builds/moses2/Jamfile index cc32eefe6..f4eda89a8 100644 --- a/contrib/other-builds/moses2/Jamfile +++ b/contrib/other-builds/moses2/Jamfile @@ -19,6 +19,7 @@ import path ; Scores.cpp SearchNormal.cpp SkeletonStatefulFF.cpp + SkeletonStatelessFF.cpp Stack.cpp StatefulFeatureFunction.cpp StatelessFeatureFunction.cpp diff --git a/contrib/other-builds/moses2/Manager.h b/contrib/other-builds/moses2/Manager.h index 6de5936f1..4102d5231 100644 --- a/contrib/other-builds/moses2/Manager.h +++ b/contrib/other-builds/moses2/Manager.h @@ -14,7 +14,7 @@ #include "Stack.h" #include "TargetPhrase.h" #include "moses/Bitmaps.h" -#include "util/pool.hh" +#include "MemPool.h" class System; class Phrase; @@ -25,7 +25,7 @@ public: Manager(System &system, const std::string &inputStr); virtual ~Manager(); - util::Pool &GetPool() + MemPool &GetPool() { return m_pool; } const System &GetSystem() const @@ -41,7 +41,7 @@ public: void Decode(); protected: - util::Pool &m_pool; + MemPool &m_pool; const System &m_system; Phrase *m_input; diff --git a/contrib/other-builds/moses2/Phrase.cpp b/contrib/other-builds/moses2/Phrase.cpp index 85b15bd34..fac0c50d1 100644 --- a/contrib/other-builds/moses2/Phrase.cpp +++ b/contrib/other-builds/moses2/Phrase.cpp @@ -8,11 +8,11 @@ #include "Phrase.h" #include "Word.h" #include "moses/Util.h" -#include "util/pool.hh" +#include "MemPool.h" using namespace std; -Phrase *Phrase::CreateFromString(util::Pool &pool, Moses::FactorCollection &vocab, const std::string &str) +Phrase *Phrase::CreateFromString(MemPool &pool, Moses::FactorCollection &vocab, const std::string &str) { vector toks = Moses::Tokenize(str); size_t size = toks.size(); @@ -32,7 +32,7 @@ void Phrase::CreateFromString(Moses::FactorCollection &vocab, const std::vector< } } -Phrase::Phrase(util::Pool &pool, size_t size) +Phrase::Phrase(MemPool &pool, size_t size) :m_size(size) { m_words = new (pool.Allocate(size)) Word[size]; diff --git a/contrib/other-builds/moses2/Phrase.h b/contrib/other-builds/moses2/Phrase.h index c124f93ed..5124f61d5 100644 --- a/contrib/other-builds/moses2/Phrase.h +++ b/contrib/other-builds/moses2/Phrase.h @@ -11,7 +11,7 @@ #include #include #include "Word.h" -#include "util/pool.hh" +#include "MemPool.h" #include "moses/FactorCollection.h" class PhraseBase @@ -27,9 +27,9 @@ class Phrase : public PhraseBase { friend std::ostream& operator<<(std::ostream &, const Phrase &); public: - static Phrase *CreateFromString(util::Pool &pool, Moses::FactorCollection &vocab, const std::string &str); + static Phrase *CreateFromString(MemPool &pool, Moses::FactorCollection &vocab, const std::string &str); - Phrase(util::Pool &pool, size_t size); + Phrase(MemPool &pool, size_t size); virtual ~Phrase(); const Word& operator[](size_t pos) const { diff --git a/contrib/other-builds/moses2/PhraseTable.cpp b/contrib/other-builds/moses2/PhraseTable.cpp index 7c3defac7..a29f899a4 100644 --- a/contrib/other-builds/moses2/PhraseTable.cpp +++ b/contrib/other-builds/moses2/PhraseTable.cpp @@ -82,7 +82,7 @@ void PhraseTable::Load(System &system) Moses::FactorCollection &vocab = system.GetVocab(); - util::Pool tmpPool; + MemPool tmpPool; vector toks; Moses::InputFileStream strme(m_path); string line; diff --git a/contrib/other-builds/moses2/Scores.cpp b/contrib/other-builds/moses2/Scores.cpp index 099bcde16..49a95f7b3 100644 --- a/contrib/other-builds/moses2/Scores.cpp +++ b/contrib/other-builds/moses2/Scores.cpp @@ -17,14 +17,14 @@ using namespace std; -Scores::Scores(util::Pool &pool, size_t numScores) +Scores::Scores(MemPool &pool, size_t numScores) :m_total(0) { m_scores = new (pool.Allocate(numScores)) SCORE[numScores]; Init(m_scores, numScores, 0); } -Scores::Scores(util::Pool &pool, size_t numScores, const Scores &origScores) +Scores::Scores(MemPool &pool, size_t numScores, const Scores &origScores) :m_total(origScores.m_total) { m_scores = new (pool.Allocate(numScores)) SCORE[numScores]; diff --git a/contrib/other-builds/moses2/Scores.h b/contrib/other-builds/moses2/Scores.h index c7c05c401..c97b06c67 100644 --- a/contrib/other-builds/moses2/Scores.h +++ b/contrib/other-builds/moses2/Scores.h @@ -9,7 +9,7 @@ #include #include #include "TypeDef.h" -#include "util/pool.hh" +#include "MemPool.h" class FeatureFunction; class System; @@ -17,8 +17,8 @@ class System; class Scores { friend std::ostream& operator<<(std::ostream &, const Scores &); public: - Scores(util::Pool &pool, size_t numScores); - Scores(util::Pool &pool, size_t numScores, const Scores &origScores); + Scores(MemPool &pool, size_t numScores); + Scores(MemPool &pool, size_t numScores, const Scores &origScores); virtual ~Scores(); SCORE GetTotalScore() const diff --git a/contrib/other-builds/moses2/SkeletonStatelessFF.cpp b/contrib/other-builds/moses2/SkeletonStatelessFF.cpp new file mode 100644 index 000000000..c92909dc8 --- /dev/null +++ b/contrib/other-builds/moses2/SkeletonStatelessFF.cpp @@ -0,0 +1,20 @@ +/* + * SkeletonStatefulFF.cpp + * + * Created on: 27 Oct 2015 + * Author: hieu + */ + +#include "SkeletonStatelessFF.h" + +SkeletonStatelessFF::SkeletonStatelessFF(size_t startInd, const std::string &line) +:StatelessFeatureFunction(startInd, line) +{ + // TODO Auto-generated constructor stub + +} + +SkeletonStatelessFF::~SkeletonStatelessFF() { + // TODO Auto-generated destructor stub +} + diff --git a/contrib/other-builds/moses2/SkeletonStatelessFF.h b/contrib/other-builds/moses2/SkeletonStatelessFF.h new file mode 100644 index 000000000..40dfd915f --- /dev/null +++ b/contrib/other-builds/moses2/SkeletonStatelessFF.h @@ -0,0 +1,17 @@ +/* + * SkeletonStatefulFF.h + * + * Created on: 27 Oct 2015 + * Author: hieu + */ + +#pragma once + +#include "StatelessFeatureFunction.h" + +class SkeletonStatelessFF : public StatelessFeatureFunction +{ +public: + SkeletonStatelessFF(size_t startInd, const std::string &line); + virtual ~SkeletonStatelessFF(); +}; diff --git a/contrib/other-builds/moses2/System.h b/contrib/other-builds/moses2/System.h index 1c1d257bb..1dbaaa637 100644 --- a/contrib/other-builds/moses2/System.h +++ b/contrib/other-builds/moses2/System.h @@ -9,7 +9,7 @@ #include #include "FeatureFunctions.h" #include "Weights.h" -#include "util/pool.hh" +#include "MemPool.h" #include "moses/FactorCollection.h" #include "moses/Parameter.h" @@ -28,10 +28,10 @@ public: const FeatureFunctions &GetFeatureFunctions() const { return m_featureFunctions; } - util::Pool &GetSystemPool() + MemPool &GetSystemPool() { return m_systemPool; } - util::Pool &GetManagerPool() + MemPool &GetManagerPool() { return m_managerPool; } Moses::FactorCollection &GetVocab() const @@ -44,8 +44,8 @@ protected: const Moses::Parameter &m_params; mutable Moses::FactorCollection m_vocab; - util::Pool m_systemPool; - util::Pool m_managerPool; + MemPool m_systemPool; + MemPool m_managerPool; FeatureFunctions m_featureFunctions; Weights m_weights; diff --git a/contrib/other-builds/moses2/TargetPhrase.cpp b/contrib/other-builds/moses2/TargetPhrase.cpp index d079f65bd..a83c60dde 100644 --- a/contrib/other-builds/moses2/TargetPhrase.cpp +++ b/contrib/other-builds/moses2/TargetPhrase.cpp @@ -10,11 +10,11 @@ #include "Scores.h" #include "Manager.h" #include "System.h" -#include "util/pool.hh" +#include "MemPool.h" using namespace std; -TargetPhrase *TargetPhrase::CreateFromString(util::Pool &pool, System &system, const std::string &str) +TargetPhrase *TargetPhrase::CreateFromString(MemPool &pool, System &system, const std::string &str) { Moses::FactorCollection &vocab = system.GetVocab(); @@ -26,7 +26,7 @@ TargetPhrase *TargetPhrase::CreateFromString(util::Pool &pool, System &system, c return ret; } -TargetPhrase::TargetPhrase(util::Pool &pool, System &system, size_t size) +TargetPhrase::TargetPhrase(MemPool &pool, System &system, size_t size) :Phrase(pool, size) { m_scores = new (pool.Allocate()) Scores(pool, system.GetFeatureFunctions().GetNumScores()); diff --git a/contrib/other-builds/moses2/TargetPhrase.h b/contrib/other-builds/moses2/TargetPhrase.h index 345ff7f35..39b7d2cf4 100644 --- a/contrib/other-builds/moses2/TargetPhrase.h +++ b/contrib/other-builds/moses2/TargetPhrase.h @@ -9,7 +9,7 @@ #include #include "Phrase.h" -#include "util/pool.hh" +#include "MemPool.h" class Scores; class Manager; @@ -19,8 +19,8 @@ class TargetPhrase : public Phrase { friend std::ostream& operator<<(std::ostream &, const TargetPhrase &); public: - static TargetPhrase *CreateFromString(util::Pool &pool, System &system, const std::string &str); - TargetPhrase(util::Pool &pool, System &system, size_t size); + static TargetPhrase *CreateFromString(MemPool &pool, System &system, const std::string &str); + TargetPhrase(MemPool &pool, System &system, size_t size); virtual ~TargetPhrase(); Scores &GetScores()