00001 #pragma once 00002 00003 #include <set> 00004 #include <vector> 00005 00006 #include <boost/shared_ptr.hpp> 00007 #include <boost/unordered_map.hpp> 00008 00009 #include "moses/Syntax/F2S/PVertexToStackMap.h" 00010 #include "moses/Syntax/KBestExtractor.h" 00011 #include "moses/Syntax/Manager.h" 00012 #include "moses/Syntax/SVertexStack.h" 00013 #include "moses/TreeInput.h" 00014 #include "moses/Word.h" 00015 00016 #include "InputTree.h" 00017 #include "RuleTrie.h" 00018 00019 namespace Moses 00020 { 00021 namespace Syntax 00022 { 00023 00024 struct SHyperedge; 00025 00026 namespace T2S 00027 { 00028 00029 template<typename RuleMatcher> 00030 class Manager : public Syntax::Manager 00031 { 00032 public: 00033 Manager(ttasksptr const& ttask); 00034 00035 void Decode(); 00036 00037 // Get the SHyperedge for the 1-best derivation. 00038 const SHyperedge *GetBestSHyperedge() const; 00039 00040 void ExtractKBest( 00041 std::size_t k, 00042 std::vector<boost::shared_ptr<KBestExtractor::Derivation> > &kBestList, 00043 bool onlyDistinct=false) const; 00044 00045 void OutputDetailedTranslationReport(OutputCollector *collector) const; 00046 00047 private: 00048 void InitializeRuleMatchers(); 00049 00050 void InitializeStacks(); 00051 00052 void RecombineAndSort(const std::vector<SHyperedge*> &, SVertexStack &); 00053 00054 InputTree m_inputTree; 00055 F2S::PVertexToStackMap m_stackMap; 00056 boost::shared_ptr<RuleTrie> m_glueRuleTrie; 00057 std::vector<boost::shared_ptr<RuleMatcher> > m_ruleMatchers; 00058 RuleMatcher *m_glueRuleMatcher; 00059 }; 00060 00061 } // T2S 00062 } // Syntax 00063 } // Moses 00064 00065 // Implementation 00066 #include "Manager-inl.h"