blob: 5317be7c8b15f5dcaaca3e3186c5c01522682dbd (
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
#ifndef EXTRACT_GHKM_RULE_H_
#define EXTRACT_GHKM_RULE_H_
#include <string>
#include <vector>
#include "Alignment.h"
namespace MosesTraining
{
namespace Syntax
{
namespace GHKM
{
class Node;
enum SymbolType { Terminal, NonTerminal };
class Symbol
{
public:
Symbol(const std::string &v, SymbolType t) : m_value(v) , m_type(t) {}
const std::string &GetValue() const {
return m_value;
}
SymbolType GetType() const {
return m_type;
}
private:
std::string m_value;
SymbolType m_type;
};
// Base class for ScfgRule and StsgRule.
class Rule
{
public:
virtual ~Rule() {}
const Alignment &GetAlignment() const {
return m_alignment;
}
virtual int Scope() const = 0;
protected:
static bool PartitionOrderComp(const Node *, const Node *);
static int Scope(const std::vector<Symbol>&);
Alignment m_alignment;
};
} // namespace GHKM
} // namespace Syntax
} // namespace MosesTraining
#endif
|