diff --git a/contrib/other-builds/moses2/Sentence.cpp b/contrib/other-builds/moses2/Sentence.cpp new file mode 100644 index 000000000..accce2a42 --- /dev/null +++ b/contrib/other-builds/moses2/Sentence.cpp @@ -0,0 +1,50 @@ +/* + * Sentence.cpp + * + * Created on: 14 Dec 2015 + * Author: hieu + */ + +#include "Sentence.h" +#include "MemPool.h" +#include "legacy/Util2.h" + +using namespace std; + +namespace Moses2 +{ + +Sentence::Sentence(long translationId, MemPool &pool, size_t size) +:InputType(translationId) +,PhraseImpl(pool, size) +{ + // TODO Auto-generated constructor stub + +} + +Sentence::~Sentence() { + // TODO Auto-generated destructor stub +} + + +Sentence *Sentence::CreateFromString(MemPool &pool, + FactorCollection &vocab, + const System &system, + const std::string &str, + long translationId) +{ + vector toks = Tokenize(str); + size_t size = toks.size(); + Sentence *ret; + + ret = new (pool.Allocate()) Sentence(translationId, pool, size); + + ret->PhraseImpl::CreateFromString(vocab, system, toks); + + + return ret; +} + + +} /* namespace Moses2 */ + diff --git a/contrib/other-builds/moses2/Sentence.h b/contrib/other-builds/moses2/Sentence.h new file mode 100644 index 000000000..28545c6bb --- /dev/null +++ b/contrib/other-builds/moses2/Sentence.h @@ -0,0 +1,34 @@ +/* + * Sentence.h + * + * Created on: 14 Dec 2015 + * Author: hieu + */ + +#ifndef SENTENCE_H_ +#define SENTENCE_H_ +#include +#include "InputType.h" +#include "Phrase.h" + +namespace Moses2 +{ +class FactorCollection; +class System; + +class Sentence : public InputType, public PhraseImpl +{ +public: + static Sentence *CreateFromString(MemPool &pool, + FactorCollection &vocab, + const System &system, + const std::string &str, + long translationId); + + Sentence(long translationId, MemPool &pool, size_t size); + virtual ~Sentence(); +}; + +} /* namespace Moses2 */ + +#endif /* SENTENCE_H_ */