blob: 9f394373a5659515f31f210ea5cb3fe6aca2c0fc (
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
|
#pragma once
#include <string>
#include "moses/TranslationModel/PhraseDictionary.h"
namespace Moses
{
class ChartParser;
class ChartCellCollectionBase;
class AllOptions;
namespace Syntax
{
class RuleTable;
// Feature function for dealing with local rule scores (that come from a
// rule table). The scores themselves are stored on TargetPhrase objects
// and the decoder accesses them directly, so this object doesn't really do
// anything except provide somewhere to store the weights and parameter values.
class RuleTableFF : public PhraseDictionary
{
public:
RuleTableFF(const std::string &);
// FIXME Delete m_table?
~RuleTableFF() {}
void Load(AllOptions::ptr const& opts);
const RuleTable *GetTable() const {
return m_table;
}
static const std::vector<RuleTableFF*> &Instances() {
return s_instances;
}
ChartRuleLookupManager *CreateRuleLookupManager(
const ChartParser &, const ChartCellCollectionBase &, std::size_t) {
assert(false);
return 0;
}
// Get the source terminal vocabulary for this table's grammar (as a set of
// factor IDs)
const boost::unordered_set<std::size_t> &GetSourceTerminalSet() const {
return m_sourceTerminalSet;
}
private:
static std::vector<RuleTableFF*> s_instances;
const RuleTable *m_table;
boost::unordered_set<std::size_t> m_sourceTerminalSet;
};
} // Syntax
} // Moses
|