00001 #pragma once 00002 00003 #include "moses/Syntax/PHyperedge.h" 00004 00005 #include "RuleMatcher.h" 00006 #include "RuleTrie.h" 00007 00008 namespace Moses 00009 { 00010 namespace Syntax 00011 { 00012 namespace T2S 00013 { 00014 00015 // TODO 00016 // 00017 template<typename Callback> 00018 class RuleMatcherSCFG : public RuleMatcher<Callback> 00019 { 00020 public: 00021 RuleMatcherSCFG(const InputTree &, const RuleTrie &); 00022 00023 ~RuleMatcherSCFG() {} 00024 00025 void EnumerateHyperedges(const InputTree::Node &, Callback &); 00026 00027 private: 00028 bool IsDescendent(const InputTree::Node &, const InputTree::Node &); 00029 00030 void Match(const InputTree::Node &, const RuleTrie::Node &, int, Callback &); 00031 00032 const InputTree &m_inputTree; 00033 const RuleTrie &m_ruleTrie; 00034 PHyperedge m_hyperedge; 00035 }; 00036 00037 } // namespace T2S 00038 } // namespace Syntax 00039 } // namespace Moses 00040 00041 // Implementation 00042 #include "RuleMatcherSCFG-inl.h"