blob: 3b5dfc895776297f18dd717d33aa68c220e82c48 (
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
|
#pragma once
#include <boost/iostreams/device/mapped_file.hpp>
#include <boost/bimap.hpp>
#include "../PhraseDictionary.h"
namespace Moses
{
class ChartParser;
class ChartCellCollectionBase;
class ChartRuleLookupManager;
class QueryEngine;
class target_text;
class ProbingPT : public PhraseDictionary
{
friend std::ostream& operator<<(std::ostream&, const ProbingPT&);
public:
ProbingPT(const std::string &line);
~ProbingPT();
void Load(AllOptions::ptr const& opts);
void InitializeForInput(ttasksptr const& ttask);
// for phrase-based model
void GetTargetPhraseCollectionBatch(const InputPathList &inputPathQueue) const;
// for syntax/hiero model (CKY+ decoding)
virtual ChartRuleLookupManager *CreateRuleLookupManager(
const ChartParser &,
const ChartCellCollectionBase &,
std::size_t);
TO_STRING();
protected:
QueryEngine *m_engine;
uint64_t m_unkId;
std::vector<uint64_t> m_sourceVocab; // factor id -> pt id
std::vector<const Factor*> m_targetVocab; // pt id -> factor*
std::vector<const AlignmentInfo*> m_aligns;
boost::iostreams::mapped_file_source file;
const char *data;
void CreateAlignmentMap(const std::string path);
TargetPhraseCollection::shared_ptr CreateTargetPhrase(const Phrase &sourcePhrase) const;
TargetPhrase *CreateTargetPhrase(const Phrase &sourcePhrase, const target_text &probingTargetPhrase) const;
const Factor *GetTargetFactor(uint64_t probingId) const;
uint64_t GetSourceProbingId(const Factor *factor) const;
std::vector<uint64_t> ConvertToProbingSourcePhrase(const Phrase &sourcePhrase, bool &ok) const;
};
} // namespace Moses
|