mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-05 02:22:21 +03:00
use OutputCollector
This commit is contained in:
parent
79f59abecd
commit
b7d261088b
50
contrib/other-builds/moses2/Sentence.cpp
Normal file
50
contrib/other-builds/moses2/Sentence.cpp
Normal 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 */
|
||||
|
34
contrib/other-builds/moses2/Sentence.h
Normal file
34
contrib/other-builds/moses2/Sentence.h
Normal 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_ */
|
Loading…
Reference in New Issue
Block a user