Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Germann <Ulrich.Germann@gmail.com>2015-03-26 19:37:04 +0300
committerUlrich Germann <Ulrich.Germann@gmail.com>2015-03-26 19:37:04 +0300
commitb3ff4ff13ac35293dcdb272f99b52388b560cb65 (patch)
tree1333c33a8a1ea4b8d4168ed17d8e20516fd2e737 /moses/Manager.cpp
parentd364211d9088667ddb98136e0c9a29b913c31717 (diff)
Managers have now access to the entire translation task.
Diffstat (limited to 'moses/Manager.cpp')
-rw-r--r--moses/Manager.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/moses/Manager.cpp b/moses/Manager.cpp
index 0e8d5758a..fe8267626 100644
--- a/moses/Manager.cpp
+++ b/moses/Manager.cpp
@@ -59,28 +59,34 @@ using namespace std;
namespace Moses
{
-Manager::Manager(InputType const& source)
- :BaseManager(source)
- ,m_transOptColl(source.CreateTranslationOptionCollection())
- ,interrupted_flag(0)
- ,m_hypoId(0)
+
+Manager::Manager(ttasksptr const& ttask)
+ : BaseManager(ttask)
+ , interrupted_flag(0)
+ , m_hypoId(0)
{
+ boost::shared_ptr<InputType> source = ttask->GetSource();
+ m_transOptColl = source->CreateTranslationOptionCollection();
+
const StaticData &staticData = StaticData::Instance();
SearchAlgorithm searchAlgorithm = staticData.GetSearchAlgorithm();
- m_search = Search::CreateSearch(*this, source, searchAlgorithm, *m_transOptColl);
+ m_search = Search::CreateSearch(*this, *source, searchAlgorithm,
+ *m_transOptColl);
- StaticData::Instance().InitializeForInput(m_source);
+ StaticData::Instance().InitializeForInput(ttask);
}
Manager::~Manager()
{
delete m_transOptColl;
delete m_search;
- // this is a comment ...
-
- StaticData::Instance().CleanUpAfterSentenceProcessing(m_source);
+ StaticData::Instance().CleanUpAfterSentenceProcessing(m_ttask.lock());
}
+const InputType&
+Manager::GetSource() const
+{ return m_source) ; }
+
/**
* Main decoder loop that translates a sentence by expanding
* hypotheses stack by stack, until the end of the sentence.
@@ -121,7 +127,8 @@ void Manager::Decode()
Timer searchTime;
searchTime.start();
m_search->Decode();
- VERBOSE(1, "Line " << m_source.GetTranslationId() << ": Search took " << searchTime << " seconds" << endl);
+ VERBOSE(1, "Line " << m_source.GetTranslationId()
+ << ": Search took " << searchTime << " seconds" << endl);
IFVERBOSE(2) {
GetSentenceStats().StopTimeTotal();
TRACE_ERR(GetSentenceStats());