Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Rule.h « extract-ghkm « phrase-extract - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b87934735cd890e77830f9e8062f06f01d194cec (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
#pragma once
#ifndef EXTRACT_GHKM_RULE_H_
#define EXTRACT_GHKM_RULE_H_

#include <string>
#include <vector>

#include "Alignment.h"

namespace MosesTraining
{
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 MosesTraining

#endif