00001
00002 #pragma once
00003
00004 #include <boost/smart_ptr/shared_ptr.hpp>
00005 #include "moses/ThreadPool.h"
00006 #include "moses/TranslationOptionCollection.h"
00007 #include "moses/IOWrapper.h"
00008 #include "moses/TranslationTask.h"
00009
00010 namespace Moses
00011 {
00012 class InputType;
00013 class OutputCollector;
00014
00015
00016 class TrainingTask : public Moses::TranslationTask
00017 {
00018
00019 protected:
00020 TrainingTask(boost::shared_ptr<Moses::InputType> const source,
00021 boost::shared_ptr<Moses::IOWrapper> const ioWrapper)
00022 : TranslationTask(source, ioWrapper)
00023 { }
00024
00025 public:
00026
00027
00028 static boost::shared_ptr<TrainingTask>
00029 create(boost::shared_ptr<InputType> const& source) {
00030 boost::shared_ptr<IOWrapper> nix;
00031 boost::shared_ptr<TrainingTask> ret(new TrainingTask(source, nix));
00032 ret->m_self = ret;
00033 return ret;
00034 }
00035
00036
00037 static boost::shared_ptr<TrainingTask>
00038 create(boost::shared_ptr<InputType> const& source,
00039 boost::shared_ptr<IOWrapper> const& ioWrapper) {
00040 boost::shared_ptr<TrainingTask> ret(new TrainingTask(source, ioWrapper));
00041 ret->m_self = ret;
00042 ret->m_scope.reset(new ContextScope);
00043 return ret;
00044 }
00045
00046
00047 static boost::shared_ptr<TrainingTask>
00048 create(boost::shared_ptr<InputType> const& source,
00049 boost::shared_ptr<IOWrapper> const& ioWrapper,
00050 boost::shared_ptr<ContextScope> const& scope) {
00051 boost::shared_ptr<TrainingTask> ret(new TrainingTask(source, ioWrapper));
00052 ret->m_self = ret;
00053 ret->m_scope = scope;
00054 return ret;
00055 }
00056
00057 ~TrainingTask()
00058 { }
00059
00060 void Run() {
00061 StaticData::Instance().InitializeForInput(this->self());
00062
00063 std::cerr << *m_source << std::endl;
00064
00065 TranslationOptionCollection *transOptColl
00066 = m_source->CreateTranslationOptionCollection(this->self());
00067 transOptColl->CreateTranslationOptions();
00068 delete transOptColl;
00069
00070 StaticData::Instance().CleanUpAfterSentenceProcessing(this->self());
00071 }
00072
00073
00074 private:
00075
00076
00077
00078 };
00079
00080
00081 }