mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-06 19:49:41 +03:00
51 lines
835 B
C++
51 lines
835 B
C++
|
/*
|
||
|
* 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<string> toks = Tokenize(str);
|
||
|
size_t size = toks.size();
|
||
|
Sentence *ret;
|
||
|
|
||
|
ret = new (pool.Allocate<Sentence>()) Sentence(translationId, pool, size);
|
||
|
|
||
|
ret->PhraseImpl::CreateFromString(vocab, system, toks);
|
||
|
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
|
||
|
} /* namespace Moses2 */
|
||
|
|