2015-03-26 21:25:54 +03:00
|
|
|
//-*- c++ -*-
|
2015-01-08 16:54:47 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <boost/smart_ptr/shared_ptr.hpp>
|
|
|
|
#include "moses/ThreadPool.h"
|
|
|
|
#include "moses/TranslationOptionCollection.h"
|
|
|
|
#include "moses/IOWrapper.h"
|
2015-04-30 08:05:11 +03:00
|
|
|
#include "moses/TranslationTask.h"
|
2015-01-08 16:54:47 +03:00
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
class InputType;
|
|
|
|
class OutputCollector;
|
|
|
|
|
|
|
|
|
2015-03-26 21:25:54 +03:00
|
|
|
class TrainingTask : public Moses::TranslationTask
|
2015-01-08 16:54:47 +03:00
|
|
|
{
|
|
|
|
|
2015-03-26 21:25:54 +03:00
|
|
|
protected:
|
2015-04-30 08:05:11 +03:00
|
|
|
TrainingTask(boost::shared_ptr<Moses::InputType> const source,
|
2015-05-02 13:45:24 +03:00
|
|
|
boost::shared_ptr<Moses::IOWrapper> const ioWrapper)
|
2015-04-30 08:05:11 +03:00
|
|
|
: TranslationTask(source, ioWrapper)
|
2015-03-26 21:25:54 +03:00
|
|
|
{ }
|
2015-04-30 08:05:11 +03:00
|
|
|
|
2015-01-08 16:54:47 +03:00
|
|
|
public:
|
|
|
|
|
2015-03-26 21:25:54 +03:00
|
|
|
// factory function
|
2015-04-30 08:05:11 +03:00
|
|
|
static boost::shared_ptr<TrainingTask>
|
2015-05-02 13:45:24 +03:00
|
|
|
create(boost::shared_ptr<InputType> const& source) {
|
2015-03-26 21:25:54 +03:00
|
|
|
boost::shared_ptr<IOWrapper> nix;
|
|
|
|
boost::shared_ptr<TrainingTask> ret(new TrainingTask(source, nix));
|
|
|
|
ret->m_self = ret;
|
|
|
|
return ret;
|
2015-01-14 14:07:42 +03:00
|
|
|
}
|
2015-01-08 16:54:47 +03:00
|
|
|
|
2015-03-26 21:25:54 +03:00
|
|
|
// factory function
|
2015-04-30 08:05:11 +03:00
|
|
|
static boost::shared_ptr<TrainingTask>
|
|
|
|
create(boost::shared_ptr<InputType> const& source,
|
2015-05-02 13:45:24 +03:00
|
|
|
boost::shared_ptr<IOWrapper> const& ioWrapper) {
|
2015-03-26 21:25:54 +03:00
|
|
|
boost::shared_ptr<TrainingTask> ret(new TrainingTask(source, ioWrapper));
|
|
|
|
ret->m_self = ret;
|
|
|
|
return ret;
|
2015-01-14 14:07:42 +03:00
|
|
|
}
|
2015-01-08 16:54:47 +03:00
|
|
|
|
2015-04-30 08:05:11 +03:00
|
|
|
~TrainingTask()
|
2015-03-26 21:25:54 +03:00
|
|
|
{ }
|
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
void Run() {
|
2015-03-26 21:25:54 +03:00
|
|
|
StaticData::Instance().InitializeForInput(this->self());
|
2015-01-14 14:07:42 +03:00
|
|
|
|
2015-01-09 14:12:40 +03:00
|
|
|
std::cerr << *m_source << std::endl;
|
2015-01-14 14:07:42 +03:00
|
|
|
|
2015-04-30 08:05:11 +03:00
|
|
|
TranslationOptionCollection *transOptColl
|
2015-05-02 13:45:24 +03:00
|
|
|
= m_source->CreateTranslationOptionCollection(this->self());
|
2015-01-08 16:54:47 +03:00
|
|
|
transOptColl->CreateTranslationOptions();
|
|
|
|
delete transOptColl;
|
2015-01-14 14:07:42 +03:00
|
|
|
|
2015-03-26 21:25:54 +03:00
|
|
|
StaticData::Instance().CleanUpAfterSentenceProcessing(this->self());
|
2015-01-08 16:54:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2015-03-26 21:25:54 +03:00
|
|
|
// Moses::InputType* m_source;
|
|
|
|
// Moses::IOWrapper &m_ioWrapper;
|
2015-01-08 16:54:47 +03:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} //namespace
|