File size: 811 Bytes
158b61b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#pragma once

#include "moses/Phrase.h"
#include "moses/TargetPhrase.h"

#include "InputTree.h"
#include "RuleTrie.h"
#include "RuleTrieCreator.h"

namespace Moses
{
namespace Syntax
{
namespace T2S
{

class GlueRuleSynthesizer : public RuleTrieCreator
{
  Word m_output_default_nonterminal;
public:
  GlueRuleSynthesizer(RuleTrie &trie, Word dflt_nonterm)
    : m_output_default_nonterminal(dflt_nonterm)
    , m_ruleTrie(trie)
  {}

  // Synthesize the minimal, montone rule that can be applied to the given node
  // and add it to the rule trie.
  void SynthesizeRule(const InputTree::Node &);

private:
  Phrase *SynthesizeSourcePhrase(const InputTree::Node &);
  TargetPhrase *SynthesizeTargetPhrase(const InputTree::Node &, const Phrase &);

  RuleTrie &m_ruleTrie;
};

}  // T2S
}  // Syntax
}  // Moses