blob: a80c756a8c1ec77ef6317620034fbf80a6b10974 (
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
|
#pragma once
#include <boost/unordered_set.hpp>
#include "moses/InputType.h"
#include "moses/BaseManager.h"
#include "KBestExtractor.h"
namespace Moses
{
namespace Syntax
{
// Common base class for Moses::Syntax managers.
class Manager : public BaseManager
{
public:
Manager(ttasksptr const& ttask);
// Virtual functions from Moses::BaseManager that are implemented the same
// way for all Syntax managers.
void OutputBest(OutputCollector *collector) const;
void OutputNBest(OutputCollector *collector) const;
void OutputUnknowns(OutputCollector *collector) const;
// Virtual functions from Moses::BaseManager that are no-ops for all Syntax
// managers.
void OutputAlignment(OutputCollector *collector) const {}
void OutputDetailedTreeFragmentsTranslationReport(
OutputCollector *collector) const {}
void OutputLatticeSamples(OutputCollector *collector) const {}
void OutputSearchGraph(OutputCollector *collector) const {}
// void OutputSearchGraphHypergraph() const {}
void
OutputSearchGraphAsHypergraph
( std::string const& fname, size_t const precision ) const
{ }
void OutputSearchGraphSLF() const {}
void OutputWordGraph(OutputCollector *collector) const {}
void OutputDetailedTranslationReport(OutputCollector *collector) const {}
void CalcDecoderStatistics() const {}
// Syntax-specific virtual functions that derived classes must implement.
virtual void ExtractKBest(
std::size_t k,
std::vector<boost::shared_ptr<KBestExtractor::Derivation> > &kBestList,
bool onlyDistinct=false) const = 0;
virtual const SHyperedge *GetBestSHyperedge() const = 0;
protected:
boost::unordered_set<Word> m_oovs;
private:
// Syntax-specific helper functions used to implement OutputNBest.
void OutputNBestList(OutputCollector *collector,
const KBestExtractor::KBestVec &nBestList,
long translationId) const;
std::size_t OutputAlignmentNBest(Alignments &retAlign,
const KBestExtractor::Derivation &d,
std::size_t startTarget) const;
std::size_t CalcSourceSize(const KBestExtractor::Derivation &d) const;
};
} // Syntax
} // Moses
|