mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-25 04:43:03 +03:00
fcbfc5a535
now have access to the current translation task. This was done to allow context-sensitive processing (if provided by the FF).
72 lines
1.6 KiB
C++
72 lines
1.6 KiB
C++
//-*- 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
|