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
|
#pragma once
#include "../PhraseTable.h"
#include "BlockHashIndex.h"
namespace Moses2
{
class PhraseDecoder;
class TPCompact;
class PhraseTableCompact: public PhraseTable
{
public:
PhraseTableCompact(size_t startInd, const std::string &line);
virtual ~PhraseTableCompact();
void Load(System &system);
virtual void SetParameter(const std::string& key, const std::string& value);
virtual TargetPhrases *Lookup(const Manager &mgr, MemPool &pool,
InputPath &inputPath) const;
// scfg
virtual void InitActiveChart(
MemPool &pool,
const SCFG::Manager &mgr,
SCFG::InputPath &path) const;
virtual void Lookup(const Manager &mgr, InputPathsBase &inputPaths) const;
virtual void Lookup(
MemPool &pool,
const SCFG::Manager &mgr,
size_t maxChartSpan,
const SCFG::Stacks &stacks,
SCFG::InputPath &path) const;
protected:
static bool s_inMemoryByDefault;
bool m_inMemory;
bool m_useAlignmentInfo;
BlockHashIndex m_hash;
StringVector<unsigned char, size_t, MmapAllocator> m_targetPhrasesMapped;
StringVector<unsigned char, size_t, std::allocator> m_targetPhrasesMemory;
friend class PhraseDecoder;
PhraseDecoder* m_phraseDecoder;
const TargetPhraseImpl *CreateTargetPhrase(
const Manager &mgr,
const TPCompact &tpCompact,
const Phrase<Word> &sourcePhrase) const;
// SCFG
virtual void LookupGivenNode(
MemPool &pool,
const SCFG::Manager &mgr,
const SCFG::ActiveChartEntry &prevEntry,
const SCFG::Word &wordSought,
const Moses2::Hypotheses *hypos,
const Moses2::Range &subPhraseRange,
SCFG::InputPath &outPath) const;
};
}
|