use OutputCollector

This commit is contained in:
Hieu Hoang 2015-12-14 13:16:40 +00:00
parent 79f59abecd
commit b7d261088b
2 changed files with 84 additions and 0 deletions

View File

@ -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<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 */

View File

@ -0,0 +1,34 @@
/*
* Sentence.h
*
* Created on: 14 Dec 2015
* Author: hieu
*/
#ifndef SENTENCE_H_
#define SENTENCE_H_
#include <string>
#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_ */