/* * TargetPhraseImpl.cpp * * Created on: 23 Oct 2015 * Author: hieu */ #include #include #include "TargetPhraseImpl.h" #include "../Scores.h" #include "../System.h" #include "../MemPool.h" #include "Manager.h" using namespace std; namespace Moses2 { TargetPhraseImpl *TargetPhraseImpl::CreateFromString(MemPool &pool, const PhraseTable &pt, const System &system, const std::string &str) { FactorCollection &vocab = system.GetVocab(); vector toks = Tokenize(str); size_t size = toks.size(); TargetPhraseImpl *ret = new (pool.Allocate()) TargetPhraseImpl(pool, pt, system, size); ret->PhraseImplTemplate::CreateFromString(vocab, system, toks); return ret; } TargetPhraseImpl::TargetPhraseImpl(MemPool &pool, const PhraseTable &pt, const System &system, size_t size) :Moses2::TargetPhrase(pool, pt, system, size) { m_scores = new (pool.Allocate()) Scores(system, pool, system.featureFunctions.GetNumScores()); size_t numWithPtData = system.featureFunctions.GetWithPhraseTableInd().size(); ffData = new (pool.Allocate(numWithPtData)) void *[numWithPtData]; } TargetPhraseImpl::~TargetPhraseImpl() { // TODO Auto-generated destructor stub } }