blob: 4d2152920562dd2468e0958cf17749baa152653a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
//-*- c++ -*-
#pragma once
#include <boost/smart_ptr/shared_ptr.hpp>
#include "moses/ThreadPool.h"
#include "moses/TranslationOptionCollection.h"
#include "moses/IOWrapper.h"
#include "moses/TranslationTask.h"
namespace Moses
{
class InputType;
class OutputCollector;
class TrainingTask : public Moses::TranslationTask
{
protected:
TrainingTask(boost::shared_ptr<Moses::InputType> const source,
boost::shared_ptr<Moses::IOWrapper> const ioWrapper)
: TranslationTask(source, ioWrapper)
{ }
public:
// factory function
static boost::shared_ptr<TrainingTask>
create(boost::shared_ptr<InputType> const& source) {
boost::shared_ptr<IOWrapper> nix;
boost::shared_ptr<TrainingTask> ret(new TrainingTask(source, nix));
ret->m_self = ret;
return ret;
}
// factory function
static boost::shared_ptr<TrainingTask>
create(boost::shared_ptr<InputType> const& source,
boost::shared_ptr<IOWrapper> const& ioWrapper) {
boost::shared_ptr<TrainingTask> ret(new TrainingTask(source, ioWrapper));
ret->m_self = ret;
return ret;
}
~TrainingTask()
{ }
void Run() {
StaticData::Instance().InitializeForInput(this->self());
std::cerr << *m_source << std::endl;
TranslationOptionCollection *transOptColl
= m_source->CreateTranslationOptionCollection(this->self());
transOptColl->CreateTranslationOptions();
delete transOptColl;
StaticData::Instance().CleanUpAfterSentenceProcessing(this->self());
}
private:
// Moses::InputType* m_source;
// Moses::IOWrapper &m_ioWrapper;
};
} //namespace
|