blob: 0644283b548116b708038b25fccc1b84e1a660ba (
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
|
#include "TranslationTask.h"
#include "System.h"
#include "InputType.h"
#include "PhraseBased/Manager.h"
#include "SCFG/Manager.h"
using namespace std;
namespace Moses2
{
TranslationTask::TranslationTask(System &system,
const std::string &line,
long translationId)
{
if (system.isPb) {
m_mgr = new Manager(system, *this, line, translationId);
} else {
m_mgr = new SCFG::Manager(system, *this, line, translationId);
}
}
TranslationTask::~TranslationTask()
{
}
std::string TranslationTask::ReturnTranslation() const
{
m_mgr->Decode();
string out;
out = m_mgr->OutputBest() + "\n";
delete m_mgr;
return out;
}
void TranslationTask::Run()
{
m_mgr->Decode();
string out;
out = m_mgr->OutputBest() + "\n";
m_mgr->system.bestCollector->Write(m_mgr->GetTranslationId(), out);
if (m_mgr->system.options.nbest.nbest_size) {
out = m_mgr->OutputNBest();
m_mgr->system.nbestCollector->Write(m_mgr->GetTranslationId(), out);
}
if (!m_mgr->system.options.output.detailed_transrep_filepath.empty()) {
out = m_mgr->OutputTransOpt();
m_mgr->system.detailedTranslationCollector->Write(m_mgr->GetTranslationId(), out);
}
delete m_mgr;
}
}
|