2015-10-23 22:53:36 +03:00
|
|
|
/*
|
|
|
|
* TargetPhrase.cpp
|
|
|
|
*
|
|
|
|
* Created on: 23 Oct 2015
|
|
|
|
* Author: hieu
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "TargetPhrase.h"
|
|
|
|
#include "Scores.h"
|
|
|
|
#include "Manager.h"
|
2015-10-24 04:02:50 +03:00
|
|
|
#include "StaticData.h"
|
|
|
|
#include "util/pool.hh"
|
2015-10-23 22:53:36 +03:00
|
|
|
|
2015-10-24 04:02:50 +03:00
|
|
|
using namespace std;
|
|
|
|
|
2015-10-24 05:32:30 +03:00
|
|
|
TargetPhrase *TargetPhrase::CreateFromString(util::Pool &pool, StaticData &staticData, const std::string &str)
|
2015-10-23 22:53:36 +03:00
|
|
|
{
|
2015-10-24 04:02:50 +03:00
|
|
|
vector<string> toks = Moses::Tokenize(str);
|
|
|
|
size_t size = toks.size();
|
2015-10-24 05:32:30 +03:00
|
|
|
TargetPhrase *ret = new (pool.Allocate<TargetPhrase>()) TargetPhrase(pool, staticData, size);
|
2015-10-24 04:02:50 +03:00
|
|
|
ret->Phrase::CreateFromString(toks);
|
2015-10-23 22:53:36 +03:00
|
|
|
|
2015-10-24 04:02:50 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-10-24 05:32:30 +03:00
|
|
|
TargetPhrase::TargetPhrase(util::Pool &pool, StaticData &staticData, size_t size)
|
2015-10-24 04:14:52 +03:00
|
|
|
:Phrase(pool, size)
|
2015-10-24 04:02:50 +03:00
|
|
|
{
|
2015-10-24 05:32:30 +03:00
|
|
|
m_scores = new (pool.Allocate<Scores>()) Scores(pool, staticData.GetNumScores());
|
2015-10-23 22:53:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TargetPhrase::~TargetPhrase() {
|
|
|
|
// TODO Auto-generated destructor stub
|
|
|
|
}
|
|
|
|
|