add Moses2 namespace

This commit is contained in:
Hieu Hoang 2015-12-10 20:49:30 +00:00
parent 7c9ee35bdf
commit 92acddb90b
121 changed files with 669 additions and 30 deletions

View File

@ -13,6 +13,9 @@
using namespace std;
namespace Moses2
{
struct DistortionState_traditional : public FFState {
Range range;
int first_gap;
@ -166,3 +169,6 @@ int Distortion::ComputeDistortionDistance(const Range& prev, const Range& curren
}
return abs(dist);
}
}

View File

@ -12,6 +12,9 @@
#include "../legacy/Range.h"
#include "../TypeDef.h"
namespace Moses2
{
class Distortion : public StatefulFeatureFunction
{
public:
@ -53,4 +56,6 @@ protected:
};
}
#endif /* DISTORTION_H_ */

View File

@ -13,6 +13,9 @@
using namespace std;
namespace Moses2
{
FeatureFunction::FeatureFunction(size_t startInd, const std::string &line)
:m_startInd(startInd)
,m_numScores(1)
@ -79,3 +82,6 @@ void FeatureFunction::SetParameter(const std::string& key, const std::string& va
UTIL_THROW2(GetName() << ": Unknown argument " << key << "=" << value);
}
}
}

View File

@ -12,6 +12,9 @@
#include <string>
#include <vector>
namespace Moses2
{
class System;
class Phrase;
class PhraseImpl;
@ -64,4 +67,7 @@ protected:
void ParseLine(const std::string &line);
};
}
#endif /* FEATUREFUNCTION_H_ */

View File

@ -27,6 +27,9 @@
using namespace std;
namespace Moses2
{
FeatureFunctions::FeatureFunctions(System &system)
:m_system(system)
,m_ffStartInd(0)
@ -101,7 +104,7 @@ FeatureFunction *FeatureFunctions::Create(const std::string &line)
ret = new PhraseTableMemory(m_ffStartInd, line);
}
else if (toks[0] == "ProbingPT") {
ret = new ProbingPT(m_ffStartInd, line);
ret = new Moses2::ProbingPT(m_ffStartInd, line);
}
else if (toks[0] == "UnknownWordPenalty") {
ret = new UnknownWordPenalty(m_ffStartInd, line);
@ -180,3 +183,6 @@ FeatureFunctions::EvaluateInIsolation(MemPool &pool, const System &system,
targetPhrase.SetEstimatedScore(estimatedScores->GetTotalScore());
}
}
}

View File

@ -12,6 +12,9 @@
#include <string>
#include "../legacy/Parameter.h"
namespace Moses2
{
class System;
class FeatureFunction;
class StatefulFeatureFunction;
@ -57,4 +60,6 @@ protected:
};
}
#endif /* FEATUREFUNCTIONS_H_ */

View File

@ -8,6 +8,9 @@
#include "PhrasePenalty.h"
#include "../Scores.h"
namespace Moses2
{
PhrasePenalty::PhrasePenalty(size_t startInd, const std::string &line)
:StatelessFeatureFunction(startInd, line)
{
@ -26,3 +29,6 @@ PhrasePenalty::EvaluateInIsolation(const System &system,
{
scores.PlusEquals(system, *this, 1);
}
}

View File

@ -9,6 +9,9 @@
#include "StatelessFeatureFunction.h"
namespace Moses2
{
class PhrasePenalty : public StatelessFeatureFunction
{
public:
@ -22,3 +25,6 @@ public:
Scores *estimatedScores) const;
};
}

View File

@ -11,6 +11,9 @@
using namespace std;
namespace Moses2
{
class SkeletonState : public FFState
{
public:
@ -78,3 +81,6 @@ void SkeletonStatefulFF::EvaluateWhenApplied(const Manager &mgr,
SkeletonState &stateCast = static_cast<SkeletonState&>(state);
stateCast.targetLen = hypo.GetTargetPhrase().GetSize();
}
}

View File

@ -10,6 +10,9 @@
#include "StatefulFeatureFunction.h"
namespace Moses2
{
class SkeletonStatefulFF : public StatefulFeatureFunction
{
public:
@ -33,4 +36,6 @@ public:
};
}
#endif /* SKELETONSTATEFULFF_H_ */

View File

@ -8,6 +8,9 @@
#include "SkeletonStatelessFF.h"
namespace Moses2
{
SkeletonStatelessFF::SkeletonStatelessFF(size_t startInd, const std::string &line)
:StatelessFeatureFunction(startInd, line)
{
@ -26,3 +29,6 @@ SkeletonStatelessFF::EvaluateInIsolation(const System &system,
{
}
}

View File

@ -9,6 +9,9 @@
#include "StatelessFeatureFunction.h"
namespace Moses2
{
class SkeletonStatelessFF : public StatelessFeatureFunction
{
public:
@ -22,3 +25,6 @@ public:
Scores *estimatedScores) const;
};
}

View File

@ -13,6 +13,9 @@
#include "StatefulFeatureFunction.h"
#include "../Search/Hypothesis.h"
namespace Moses2
{
StatefulFeatureFunction::StatefulFeatureFunction(size_t startInd, const std::string &line)
:FeatureFunction(startInd, line)
{
@ -52,3 +55,6 @@ void StatefulFeatureFunction::EvaluateWhenApplied(const ObjectPoolContiguous<Hyp
// s = pthread_setaffinity_np(handle, sizeof(cpu_set_t), &cpusetOrig);
#endif
}
}

View File

@ -13,6 +13,9 @@
#include "../MemPool.h"
#include "../Recycler.h"
namespace Moses2
{
class Hypothesis;
class StatefulFeatureFunction : public FeatureFunction
@ -53,4 +56,7 @@ protected:
};
}
#endif /* STATEFULFEATUREFUNCTION_H_ */

View File

@ -7,6 +7,9 @@
#include "StatelessFeatureFunction.h"
namespace Moses2
{
StatelessFeatureFunction::StatelessFeatureFunction(size_t startInd, const std::string &line)
:FeatureFunction(startInd, line)
{
@ -18,3 +21,5 @@ StatelessFeatureFunction::~StatelessFeatureFunction() {
// TODO Auto-generated destructor stub
}
}

View File

@ -10,6 +10,9 @@
#include "FeatureFunction.h"
namespace Moses2
{
class StatelessFeatureFunction : public FeatureFunction
{
public:
@ -17,4 +20,6 @@ public:
virtual ~StatelessFeatureFunction();
};
}
#endif /* STATELESSFEATUREFUNCTION_H_ */

View File

@ -10,6 +10,9 @@
#include "../Scores.h"
#include "../TargetPhrase.h"
namespace Moses2
{
WordPenalty::WordPenalty(size_t startInd, const std::string &line)
:StatelessFeatureFunction(startInd, line)
{
@ -31,4 +34,6 @@ WordPenalty::EvaluateInIsolation(const System &system,
scores.PlusEquals(system, *this, score);
}
}

View File

@ -10,6 +10,9 @@
#include "StatelessFeatureFunction.h"
namespace Moses2
{
class WordPenalty : public StatelessFeatureFunction
{
public:
@ -25,5 +28,7 @@ public:
};
}
#endif /* WORDPENALTY_H_ */

View File

@ -8,6 +8,9 @@
#include "InputPath.h"
#include "TranslationModel/PhraseTable.h"
namespace Moses2
{
InputPath::InputPath(const SubPhrase &subPhrase,
const Range &range,
size_t numPt,
@ -51,3 +54,6 @@ std::ostream& operator<<(std::ostream &out, const InputPath &obj)
out << obj.range << " " << obj.subPhrase;
return out;
}
}

View File

@ -12,7 +12,10 @@
#include "Phrase.h"
#include "TargetPhrases.h"
#include "legacy/Range.h"
;
namespace Moses2
{
class PhraseTable;
class InputPath {
@ -35,4 +38,6 @@ protected:
bool m_isUsed;
};
}
#endif /* INPUTPATH_H_ */

View File

@ -12,6 +12,9 @@
using namespace std;
namespace Moses2
{
InputPaths::~InputPaths() {
// TODO Auto-generated destructor stub
}
@ -58,3 +61,5 @@ void InputPaths::DeleteUnusedPaths()
}
}
}

View File

@ -12,6 +12,9 @@
#include "InputPath.h"
#include "MemPool.h"
namespace Moses2
{
class PhraseImpl;
class System;
@ -46,4 +49,7 @@ protected:
Coll m_inputPaths;
};
}
#endif /* INPUTPATHS_H_ */

View File

@ -18,6 +18,9 @@
using namespace std;
namespace Moses2
{
struct KenLMState : public FFState {
lm::ngram::State state;
virtual size_t hash() const {
@ -283,3 +286,5 @@ lm::WordIndex *KENLM::LastIDs(const Hypothesis &hypo, lm::WordIndex *indices) co
}
}
}

View File

@ -14,6 +14,9 @@
#include "../legacy/Factor.h"
#include "../legacy/Util2.h"
namespace Moses2
{
class Word;
class KENLM : public StatefulFeatureFunction
@ -78,4 +81,6 @@ protected:
};
}
#endif /* FF_LM_KENLM_H_ */

View File

@ -18,6 +18,9 @@
using namespace std;
namespace Moses2
{
struct LMState : public PointerState
{
LMState()
@ -309,3 +312,6 @@ void LanguageModel::DebugContext(const std::vector<const Factor*> &context) cons
}
cerr << endl;
}
}

View File

@ -14,6 +14,9 @@
#include "../legacy/Factor.h"
#include "../legacy/Util2.h"
namespace Moses2
{
////////////////////////////////////////////////////////////////////////////////////////
struct LMScores
{
@ -82,4 +85,7 @@ protected:
void DebugContext(const std::vector<const Factor*> &context) const;
};
}
#endif /* LANGUAGEMODEL_H_ */

View File

@ -14,6 +14,9 @@
using namespace std;
namespace Moses2
{
//////////////////////////////////////////////////////////////////////////////////////////
class Murmur: public DALM::State::HashFunction
{
@ -218,12 +221,14 @@ void LanguageModelDALM::EmptyHypothesisState(FFState &state, const Manager &mgr,
}
void LanguageModelDALM::EvaluateWhenApplied(const Manager &mgr,
const Hypothesis &hypo,
const FFState &prevState,
Scores &scores,
FFState &state) const
{
void LanguageModelDALM::EvaluateWhenApplied(const Manager &mgr,
const Hypothesis &hypo,
const FFState &prevState,
Scores &scores,
FFState &state) const
{
}
}
}

View File

@ -10,6 +10,7 @@
#include "../legacy/Util2.h"
#include "../legacy/Factor.h"
namespace DALM
{
class Logger;
@ -22,6 +23,9 @@ class Gap;
typedef unsigned int VocabId;
}
namespace Moses2
{
class LanguageModelDALM : public StatefulFeatureFunction
{
public:
@ -66,3 +70,5 @@ protected:
};
}

View File

@ -13,11 +13,11 @@ using namespace std;
//extern size_t g_numHypos;
istream &GetInputStream(Parameter &params)
istream &GetInputStream(Moses2::Parameter &params)
{
const PARAM_VEC *vec = params.GetParam("input-file");
const Moses2::PARAM_VEC *vec = params.GetParam("input-file");
if (vec && vec->size()) {
InputFileStream *stream = new InputFileStream(vec->at(0));
Moses2::InputFileStream *stream = new Moses2::InputFileStream(vec->at(0));
return *stream;
}
else {
@ -33,9 +33,9 @@ int main(int argc, char** argv)
//Temp();
Parameter params;
Moses2::Parameter params;
params.LoadParam(argc, argv);
System system(params);
Moses2::System system(params);
istream &inStream = GetInputStream(params);
@ -43,11 +43,11 @@ int main(int argc, char** argv)
Moses2::Timer timer;
timer.start();
ThreadPool pool(system.numThreads);
Moses2::ThreadPool pool(system.numThreads);
string line;
while (getline(inStream, line)) {
boost::shared_ptr<TranslationTask> task(new TranslationTask(system, line));
boost::shared_ptr<Moses2::TranslationTask> task(new Moses2::TranslationTask(system, line));
pool.Submit(task);
//task->Run();

View File

@ -12,6 +12,9 @@
using namespace std;
namespace Moses2
{
MemPool::Page::Page(std::size_t vSize)
:size(vSize)
{
@ -78,3 +81,5 @@ void MemPool::Reset()
current_ = m_pages[0]->mem;
}
}

View File

@ -16,6 +16,9 @@
#include <limits>
#include <iostream>
namespace Moses2
{
class MemPool {
struct Page {
uint8_t *mem;
@ -160,4 +163,7 @@ std::ostream& operator<<(std::ostream &out, const ObjectPoolContiguous<T> &obj)
return out;
}
}
#endif /* MEMPOOL_H_ */

View File

@ -4,6 +4,9 @@
#include <vector>
#include "Node.h"
namespace Moses2
{
template<class KeyClass, class ValueClass>
class MorphTrie
{
@ -88,5 +91,7 @@ std::vector<const Node<KeyClass, ValueClass>* > MorphTrie<KeyClass, ValueClass>:
return ret;
}
}
#endif /* end of include guard: MORPHTRIE_H_ */

View File

@ -5,6 +5,9 @@
#include <boost/unordered_map.hpp>
#include <boost/foreach.hpp>
namespace Moses2
{
template<class KeyClass, class ValueClass>
class Node
{
@ -78,4 +81,6 @@ Node<KeyClass, ValueClass>* Node<KeyClass, ValueClass>::findSub(const KeyClass&
return NULL;
}
}
#endif /* end of include guard: NODE_H_ */

View File

@ -9,6 +9,9 @@
using namespace std;
namespace Moses2
{
inline void ParseLineByChar(string& line, char c, vector<string>& substrings) {
size_t i = 0;
size_t j = line.find(c);
@ -22,3 +25,6 @@ inline void ParseLineByChar(string& line, char c, vector<string>& substrings) {
substrings.push_back(line.substr(i, line.length()));
}
}
}

View File

@ -13,6 +13,9 @@
using namespace std;
namespace Moses2
{
size_t Phrase::hash() const
{
size_t seed = 0;
@ -116,3 +119,6 @@ std::ostream& operator<<(std::ostream &out, const SubPhrase &obj)
}
return out;
}
}

View File

@ -14,6 +14,9 @@
#include "MemPool.h"
#include "legacy/FactorCollection.h"
namespace Moses2
{
class SubPhrase;
class Phrase
@ -89,3 +92,6 @@ public:
return a.GetSize() < b.GetSize();
}
};
}

View File

@ -10,6 +10,9 @@
#include <vector>
namespace Moses2
{
template<typename T>
class Recycler {
typedef std::vector<T> Coll;
@ -62,4 +65,7 @@ protected:
Coll m_coll;
};
}
#endif /* RECYCLER_H_ */

View File

@ -17,6 +17,9 @@
using namespace std;
namespace Moses2
{
Scores::Scores(const System &system, MemPool &pool, size_t numScores)
:m_total(0)
{
@ -183,3 +186,6 @@ std::ostream& operator<<(std::ostream &out, const Scores &obj)
}
return out;
}
}

View File

@ -11,6 +11,9 @@
#include "TypeDef.h"
#include "MemPool.h"
namespace Moses2
{
class FeatureFunction;
class FeatureFunctions;
class System;
@ -58,3 +61,5 @@ protected:
SCORE m_total;
};
}

View File

@ -11,6 +11,9 @@
using namespace std;
namespace Moses2
{
ArcLists::ArcLists() {
// TODO Auto-generated constructor stub
@ -68,3 +71,5 @@ ArcList *ArcLists::GetAndDetachArcList(const Hypothesis *hypo)
return arcList;
}
}

View File

@ -10,6 +10,9 @@
#include <vector>
#include <boost/unordered_map.hpp>
namespace Moses2
{
class Hypothesis;
typedef std::vector<const Hypothesis*> ArcList;
@ -30,4 +33,6 @@ protected:
};
}
#endif /* ARCLISTS_H_ */

View File

@ -11,6 +11,9 @@
using namespace std;
namespace Moses2
{
namespace NSCubePruning
{
@ -142,4 +145,6 @@ void CubeEdge::Prefetch(Manager &mgr, const QueueItem *item, Queue &queue, SeenP
}
}

View File

@ -14,6 +14,9 @@
#include "../../TypeDef.h"
#include "../../Vector.h"
namespace Moses2
{
class Manager;
class InputPath;
class TargetPhrases;
@ -83,6 +86,7 @@ protected:
};
}
}

View File

@ -16,12 +16,15 @@
using namespace std;
namespace Moses2
{
namespace NSCubePruning
{
////////////////////////////////////////////////////////////////////////
Search::Search(Manager &mgr)
: ::Search(mgr)
:Moses2::Search(mgr)
,m_queue(mgr.system.GetQueue())
,m_seenPositions(mgr.system.GetSeenPositions())
{
@ -214,4 +217,6 @@ void Search::Prefetch(size_t stackInd)
}
}

View File

@ -12,6 +12,9 @@
#include "Stacks.h"
#include "../../legacy/Range.h"
namespace Moses2
{
class Bitmap;
class Hypothesis;
class InputPath;
@ -20,7 +23,7 @@ class TargetPhrases;
namespace NSCubePruning
{
class Search : public ::Search
class Search : public Moses2::Search
{
public:
Search(Manager &mgr);
@ -48,4 +51,5 @@ protected:
}
}

View File

@ -14,6 +14,9 @@
using namespace std;
namespace Moses2
{
namespace NSCubePruning
{
CubeEdge::Hypotheses &HypothesisSet::GetSortedHypos(const Manager &mgr) const
@ -178,3 +181,5 @@ HypothesisSet &Stack::GetHypothesisSet(const HypoCoverage &key)
}
}

View File

@ -14,6 +14,9 @@
#include "../../Vector.h"
#include "../../legacy/Util2.h"
namespace Moses2
{
class Manager;
namespace NSCubePruning
@ -79,4 +82,6 @@ protected:
}
}

View File

@ -9,6 +9,9 @@
using namespace std;
namespace Moses2
{
namespace NSCubePruning
{
@ -47,4 +50,6 @@ void Stacks::Add(const Hypothesis *hypo, Recycler<Hypothesis*> &hypoRecycle)
}
}

View File

@ -10,6 +10,9 @@
#include <vector>
#include "Stack.h"
namespace Moses2
{
namespace NSCubePruning
{
@ -39,4 +42,6 @@ protected:
}
}

View File

@ -16,6 +16,9 @@
using namespace std;
namespace Moses2
{
//size_t g_numHypos = 0;
Hypothesis *Hypothesis::Create(Manager &mgr)
@ -235,14 +238,16 @@ const Word &Hypothesis::GetWord(size_t pos) const {
void Hypothesis::Swap(Hypothesis &other)
{
::Swap(m_targetPhrase, other.m_targetPhrase);
::Swap(m_sourceCompleted, other.m_sourceCompleted);
::Swap(m_range, other.m_range);
::Swap(m_prevHypo, other.m_prevHypo);
::Swap(m_ffStates, other.m_ffStates);
::Swap(m_estimatedScore, other.m_estimatedScore);
::Swap(m_currTargetWordsRange, other.m_currTargetWordsRange);
/*
Swap(m_targetPhrase, other.m_targetPhrase);
Swap(m_sourceCompleted, other.m_sourceCompleted);
Swap(m_range, other.m_range);
Swap(m_prevHypo, other.m_prevHypo);
Swap(m_ffStates, other.m_ffStates);
Swap(m_estimatedScore, other.m_estimatedScore);
Swap(m_currTargetWordsRange, other.m_currTargetWordsRange);
*/
}
}

View File

@ -15,6 +15,9 @@
#include "../TargetPhrase.h"
#include "../legacy/Range.h"
namespace Moses2
{
class Manager;
class PhraseImpl;
class TargetPhrase;
@ -127,3 +130,5 @@ public:
}
};
}

View File

@ -20,6 +20,9 @@
using namespace std;
namespace Moses2
{
Manager::Manager(System &sys, const TranslationTask &task, const std::string &inputStr)
:system(sys)
,task(task)
@ -161,3 +164,5 @@ void Manager::OutputBest(std::ostream &out) const
}
}

View File

@ -17,6 +17,9 @@
#include "../legacy/Bitmaps.h"
#include "../legacy/SquareMatrix.h"
namespace Moses2
{
class System;
class TranslationTask;
class PhraseImpl;
@ -81,3 +84,5 @@ protected:
void CalcFutureScore();
};
}

View File

@ -11,6 +11,9 @@
#include "../legacy/Bitmap.h"
#include "../legacy/Range.h"
namespace Moses2
{
Search::Search(Manager &mgr)
:m_mgr(mgr)
{
@ -112,3 +115,7 @@ bool Search::CanExtend(const Bitmap &hypoBitmap, size_t hypoRangeEndPos, const R
return true;
}
}

View File

@ -10,6 +10,9 @@
#include <stddef.h>
namespace Moses2
{
class Manager;
class Stack;
class Hypothesis;
@ -33,4 +36,7 @@ protected:
};
}
#endif /* SEARCH_SEARCH_H_ */

View File

@ -17,6 +17,9 @@
using namespace std;
namespace Moses2
{
SearchNormal::SearchNormal(Manager &mgr)
:Search(mgr)
{
@ -136,3 +139,5 @@ const Hypothesis *SearchNormal::GetBestHypothesis() const
return best;
}
}

View File

@ -15,6 +15,9 @@
#include "Search.h"
#include "Stacks.h"
namespace Moses2
{
class Hypothesis;
class InputPath;
class TargetPhrases;
@ -48,4 +51,7 @@ protected:
};
}
#endif /* SEARCHNORMAL_H_ */

View File

@ -19,6 +19,9 @@
using namespace std;
namespace Moses2
{
SearchNormalBatch::SearchNormalBatch(Manager &mgr)
:Search(mgr)
,m_batchForEval(&mgr.system.GetBatchForEval())
@ -176,3 +179,5 @@ const Hypothesis *SearchNormalBatch::GetBestHypothesis() const
return best;
}
}

View File

@ -17,6 +17,9 @@
#include "Search.h"
#include "Stacks.h"
namespace Moses2
{
class Hypothesis;
class InputPath;
class TargetPhrases;
@ -55,4 +58,6 @@ protected:
};
}

View File

@ -12,6 +12,9 @@
using namespace std;
namespace Moses2
{
Stack::Stack() {
// TODO Auto-generated constructor stub
@ -87,4 +90,6 @@ std::vector<const Hypothesis*> Stack::GetBestHypos(size_t num) const
return ret;
}
}

View File

@ -12,6 +12,9 @@
#include "../TypeDef.h"
#include "../legacy/Util2.h"
namespace Moses2
{
class Stack {
protected:
typedef boost::unordered_set<const Hypothesis*, UnorderedComparer<Hypothesis>, UnorderedComparer<Hypothesis> > _HCType;
@ -44,3 +47,5 @@ protected:
};
}

View File

@ -9,6 +9,9 @@
using namespace std;
namespace Moses2
{
Stacks::Stacks() {
// TODO Auto-generated constructor stub
@ -52,3 +55,5 @@ void Stacks::Add(const Hypothesis *hypo, Recycler<Hypothesis*> &hypoRecycle)
}
}

View File

@ -10,6 +10,9 @@
#include <vector>
#include "Stack.h"
namespace Moses2
{
class Stacks {
friend std::ostream& operator<<(std::ostream &, const Stacks &);
public:
@ -38,3 +41,5 @@ protected:
std::vector<Stack*> m_stacks;
};
}

View File

@ -17,6 +17,9 @@
using namespace std;
namespace Moses2
{
System::System(const Parameter &paramsArg)
:params(paramsArg)
,featureFunctions(*this)
@ -170,3 +173,6 @@ NSCubePruning::CubeEdge::SeenPositions &System::GetSeenPositions() const
NSCubePruning::CubeEdge::SeenPositions &ret = GetThreadSpecificObj(m_seenPositions);
return ret;
}
}

View File

@ -17,6 +17,9 @@
#include "TypeDef.h"
#include "Search/CubePruning/Misc.h"
namespace Moses2
{
class FeatureFunction;
class StatefulFeatureFunction;
class PhraseTable;
@ -71,3 +74,5 @@ protected:
void ini_performance_options();
};
}

View File

@ -14,6 +14,9 @@
using namespace std;
namespace Moses2
{
TargetPhrase *TargetPhrase::CreateFromString(MemPool &pool, const System &system, const std::string &str)
{
FactorCollection &vocab = system.GetVocab();
@ -52,3 +55,5 @@ std::ostream& operator<<(std::ostream &out, const TargetPhrase &obj)
out << (const PhraseImpl&) obj << " SCORES:" << obj.GetScores();
return out;
}
}

View File

@ -11,6 +11,9 @@
#include "Phrase.h"
#include "MemPool.h"
namespace Moses2
{
class Scores;
class Manager;
class System;
@ -54,3 +57,5 @@ struct CompareFutureScore {
}
};
}

View File

@ -10,6 +10,9 @@
using namespace std;
namespace Moses2
{
TargetPhrases::TargetPhrases(MemPool &pool, size_t reserve)
:m_coll(pool, reserve)
,m_currInd(0)
@ -64,4 +67,6 @@ const TargetPhrases *TargetPhrases::Clone(MemPool &pool, const System &system) c
return ret;
}
}

View File

@ -10,6 +10,9 @@
#include "Vector.h"
#include "TargetPhrase.h"
namespace Moses2
{
class TargetPhrases {
friend std::ostream& operator<<(std::ostream &, const TargetPhrases &);
typedef Vector<const TargetPhrase*> Coll;
@ -50,3 +53,5 @@ protected:
size_t m_currInd;
};
}

View File

@ -14,6 +14,9 @@
using namespace std;
namespace Moses2
{
////////////////////////////////////////////////////////////////////////////
PhraseTable::PhraseTable(size_t startInd, const std::string &line)
:StatelessFeatureFunction(startInd, line)
@ -165,3 +168,5 @@ void PhraseTable::ReduceCache() const
}
}
}

View File

@ -12,6 +12,9 @@
#include "../FF/StatelessFeatureFunction.h"
#include "../legacy/Util2.h"
namespace Moses2
{
class System;
class InputPaths;
class InputPath;
@ -68,3 +71,5 @@ protected:
};
}

View File

@ -17,6 +17,9 @@
using namespace std;
namespace Moses2
{
PhraseTableMemory::Node::Node()
:m_unsortedTPS(NULL)
{}
@ -142,3 +145,5 @@ TargetPhrases::shared_const_ptr PhraseTableMemory::Lookup(const Manager &mgr, In
return tps;
}
}

View File

@ -10,6 +10,9 @@
#include "PhraseTable.h"
#include "../legacy/Util2.h"
namespace Moses2
{
class PhraseTableMemory : public PhraseTable
{
//////////////////////////////////////
@ -44,4 +47,7 @@ protected:
Node m_root;
};
}
#endif /* PHRASETABLEMEMORY_H_ */

View File

@ -16,6 +16,9 @@
using namespace std;
namespace Moses2
{
ProbingPT::ProbingPT(size_t startInd, const std::string &line)
:PhraseTable(startInd, line)
{
@ -195,3 +198,5 @@ std::vector<uint64_t> ProbingPT::ConvertToProbingSourcePhrase(const Phrase &sour
}
}

View File

@ -11,6 +11,9 @@
#include <boost/bimap.hpp>
#include "PhraseTable.h"
namespace Moses2
{
class Phrase;
class QueryEngine;
class target_text;
@ -51,4 +54,6 @@ protected:
};
}
#endif /* FF_TRANSLATIONMODEL_PROBINGPT_H_ */

View File

@ -11,6 +11,9 @@
#include "../Scores.h"
#include "../Search/Manager.h"
namespace Moses2
{
UnknownWordPenalty::UnknownWordPenalty(size_t startInd, const std::string &line)
:PhraseTable(startInd, line)
{
@ -87,3 +90,6 @@ UnknownWordPenalty::EvaluateInIsolation(const System &system,
{
}
}

View File

@ -10,6 +10,9 @@
#include "PhraseTable.h"
namespace Moses2
{
class UnknownWordPenalty : public PhraseTable
{
public:
@ -27,4 +30,6 @@ public:
};
}
#endif /* UNKNOWNWORDPENALTY_H_ */

View File

@ -4,6 +4,9 @@
using namespace std;
namespace Moses2
{
TranslationTask::TranslationTask(System &system, const std::string &line)
{
m_mgr = new Manager(system, *this, line);
@ -19,3 +22,6 @@ void TranslationTask::Run()
m_mgr->Decode();
m_mgr->OutputBest(cout);
}
}

View File

@ -2,6 +2,9 @@
#include <string>
#include "legacy/ThreadPool.h"
namespace Moses2
{
class System;
class Manager;
@ -16,3 +19,6 @@ public:
protected:
Manager *m_mgr;
};
}

View File

@ -8,6 +8,9 @@
#include <cstddef>
namespace Moses2
{
class Hypothesis;
const size_t DEFAULT_MAX_TRANS_OPT_CACHE_SIZE = 10000;
@ -52,5 +55,7 @@ public:
}
};
}

View File

@ -7,3 +7,8 @@
#include "Vector.h"
namespace Moses2
{
}

View File

@ -9,6 +9,9 @@
#include <cassert>
#include "MemPool.h"
namespace Moses2
{
template <typename T>
class Vector {
public:
@ -56,3 +59,5 @@ protected:
T *m_arr;
};
}

View File

@ -14,6 +14,9 @@
using namespace std;
namespace Moses2
{
Weights::Weights()
{
// TODO Auto-generated constructor stub
@ -68,3 +71,6 @@ void Weights::CreateFromString(const FeatureFunctions &ffs, const std::string &l
m_weights[i + startInd] = score;
}
}
}

View File

@ -12,6 +12,9 @@
#include <vector>
#include "TypeDef.h"
namespace Moses2
{
class FeatureFunctions;
class Weights {
@ -33,4 +36,7 @@ protected:
std::vector<SCORE> m_weights;
};
}
#endif /* WEIGHTS_H_ */

View File

@ -13,6 +13,9 @@
using namespace std;
namespace Moses2
{
Word::Word() {
Init<const Factor*>(m_factors, MAX_NUM_FACTORS, NULL);
}
@ -77,3 +80,6 @@ std::ostream& operator<<(std::ostream &out, const Word &obj)
}
return out;
}
}

View File

@ -12,6 +12,9 @@
#include "legacy/Factor.h"
#include "legacy/FactorCollection.h"
namespace Moses2
{
class Word {
friend std::ostream& operator<<(std::ostream &, const Word &);
public:
@ -46,3 +49,5 @@ protected:
};
}

View File

@ -22,6 +22,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <boost/functional/hash.hpp>
#include "Bitmap.h"
namespace Moses2
{
Bitmap::Bitmap(size_t size, const std::vector<bool>& initializer)
:m_bitmap(initializer.begin(), initializer.end())
{
@ -86,3 +89,5 @@ std::ostream& operator<<(std::ostream& out, const Bitmap& bitmap)
return out;
}
}

View File

@ -30,6 +30,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <cstdlib>
#include "Range.h"
namespace Moses2
{
typedef unsigned long WordsBitmapID;
/** Vector of boolean to represent whether a word has been translated or not.
@ -240,3 +243,4 @@ public:
};
}

View File

@ -4,6 +4,9 @@
using namespace std;
namespace Moses2
{
Bitmaps::Bitmaps(size_t inputSize, const std::vector<bool> &initSourceCompleted)
{
m_initBitmap = new Bitmap(inputSize, initSourceCompleted);
@ -52,3 +55,5 @@ const Bitmap &Bitmaps::GetBitmap(const Bitmap &bm, const Range &range)
return *newBM;
}
}

View File

@ -6,6 +6,9 @@
#include "Bitmap.h"
#include "Util2.h"
namespace Moses2
{
class Bitmaps
{
typedef boost::unordered_map<Range, const Bitmap*> NextBitmaps;
@ -26,3 +29,5 @@ public:
};
}

View File

@ -4,6 +4,9 @@
#include <stddef.h>
#include "util/exception.hh"
namespace Moses2
{
class FFState
{
public:
@ -40,3 +43,7 @@ public:
}
};
}

View File

@ -25,6 +25,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
using namespace std;
namespace Moses2
{
// friend
ostream& operator<<(ostream& out, const Factor& factor)
@ -39,5 +41,6 @@ size_t hash_value(const Factor& f)
return hasher(f.GetId());
}
}

View File

@ -26,6 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <vector>
#include "util/string_piece.hh"
namespace Moses2
{
struct FactorFriend;
class FactorCollection;
@ -90,3 +93,5 @@ public:
size_t hash_value(const Factor &f);
}

View File

@ -32,6 +32,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
using namespace std;
namespace Moses2
{
const Factor *FactorCollection::AddFactor(const StringPiece &factorString, const System &system, bool isNonTerminal)
{
FactorFriend to_ins;
@ -98,5 +101,5 @@ ostream& operator<<(ostream& out, const FactorCollection& factorCollection)
return out;
}
}

View File

@ -40,6 +40,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "util/pool.hh"
#include "Factor.h"
namespace Moses2
{
class System;
/** We don't want Factor to be copyable by anybody. But we also want to store
@ -64,7 +67,7 @@ struct FactorFriend {
class FactorCollection
{
friend std::ostream& operator<<(std::ostream&, const FactorCollection&);
friend class ::System;
friend class System;
struct HashFactor : public std::unary_function<const FactorFriend &, std::size_t> {
std::size_t operator()(const FactorFriend &factor) const {
@ -112,3 +115,5 @@ public:
};
}

View File

@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
using namespace std;
namespace Moses2
{
InputFileStream::InputFileStream(const std::string &filePath)
: std::istream(NULL)
, m_streambuf(NULL)
@ -54,4 +57,5 @@ void InputFileStream::Close()
{
}
}

View File

@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <fstream>
#include <string>
namespace Moses2
{
/** Used in place of std::istream, can read zipped files if it ends in .gz
*/
class InputFileStream : public std::istream
@ -39,3 +42,5 @@ public:
void Close();
};
}

View File

@ -38,6 +38,9 @@ using namespace std;
using namespace boost::algorithm;
namespace po = boost::program_options;
namespace Moses2
{
/** define allowed parameters */
Parameter::Parameter()
{
@ -1622,5 +1625,7 @@ SetParameter(bool& var, std::string const& name)
SetParameter(var,name,false);
}
}

View File

@ -28,6 +28,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <boost/program_options.hpp>
#include "Util2.h"
namespace Moses2
{
typedef std::vector<std::string> PARAM_VEC;
typedef std::map<std::string, PARAM_VEC > PARAM_MAP;
typedef std::map<std::string, bool> PARAM_BOOL;
@ -163,3 +166,5 @@ public:
template<>
void Parameter::SetParameter<bool>(bool &var, const std::string &name, const bool &defaultValue) const;
}

View File

@ -3,6 +3,9 @@
#include <sstream>
#include "FFState.h"
namespace Moses2
{
struct PointerState : public FFState {
const void* lmstate;
@ -31,3 +34,5 @@ struct PointerState : public FFState {
};
}

Some files were not shown because too many files have changed in this diff Show More