00001 #pragma once 00002 00003 #include "moses/Phrase.h" 00004 #include "moses/TargetPhrase.h" 00005 00006 #include "InputTree.h" 00007 #include "RuleTrie.h" 00008 #include "RuleTrieCreator.h" 00009 00010 namespace Moses 00011 { 00012 namespace Syntax 00013 { 00014 namespace T2S 00015 { 00016 00017 class GlueRuleSynthesizer : public RuleTrieCreator 00018 { 00019 Word m_output_default_nonterminal; 00020 public: 00021 GlueRuleSynthesizer(RuleTrie &trie, Word dflt_nonterm) 00022 : m_output_default_nonterminal(dflt_nonterm) 00023 , m_ruleTrie(trie) 00024 {} 00025 00026 // Synthesize the minimal, montone rule that can be applied to the given node 00027 // and add it to the rule trie. 00028 void SynthesizeRule(const InputTree::Node &); 00029 00030 private: 00031 Phrase *SynthesizeSourcePhrase(const InputTree::Node &); 00032 TargetPhrase *SynthesizeTargetPhrase(const InputTree::Node &, const Phrase &); 00033 00034 RuleTrie &m_ruleTrie; 00035 }; 00036 00037 } // T2S 00038 } // Syntax 00039 } // Moses