blob: 6bd53cc8913b4495ce08e0874c95985da02b8c3b (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* Manager.h
*
* Created on: 23 Oct 2015
* Author: hieu
*/
#pragma once
#include <queue>
#include <cstddef>
#include <string>
#include <deque>
#include "../ManagerBase.h"
#include "Stacks.h"
#include "InputPaths.h"
#include "Misc.h"
namespace Moses2
{
namespace SCFG
{
class SymbolBind;
class TargetPhraseImpl;
class SymbolBindElement;
class Manager: public Moses2::ManagerBase
{
public:
Manager(System &sys, const TranslationTask &task, const std::string &inputStr,
long translationId);
virtual ~Manager();
void Decode();
std::string OutputBest() const;
std::string OutputNBest();
std::string OutputTransOpt();
const InputPaths &GetInputPaths() const
{ return m_inputPaths; }
QueueItemRecycler &GetQueueItemRecycler()
{ return m_queueItemRecycler; }
const Stacks &GetStacks() const
{ return m_stacks; }
protected:
Stacks m_stacks;
SCFG::InputPaths m_inputPaths;
void InitActiveChart(SCFG::InputPath &path);
void Lookup(SCFG::InputPath &path);
void LookupUnary(SCFG::InputPath &path);
void Decode(SCFG::InputPath &path, Stack &stack);
void ExpandHypo(
const SCFG::InputPath &path,
const SCFG::SymbolBind &symbolBind,
const SCFG::TargetPhraseImpl &tp,
Stack &stack);
bool IncrPrevHypoIndices(
Vector<size_t> &prevHyposIndices,
size_t ind,
const std::vector<const SymbolBindElement*> ntEles);
// cube pruning
Queue m_queue;
SeenPositions m_seenPositions;
QueueItemRecycler m_queueItemRecycler;
void CreateQueue(
const SCFG::InputPath &path,
const SymbolBind &symbolBind,
const SCFG::TargetPhrases &tps);
};
}
}
|