00001 #pragma once 00002 00003 #include <string> 00004 00005 #include "moses/TranslationModel/PhraseDictionary.h" 00006 00007 namespace Moses 00008 { 00009 00010 class ChartParser; 00011 class ChartCellCollectionBase; 00012 class AllOptions; 00013 namespace Syntax 00014 { 00015 00016 class RuleTable; 00017 00018 // Feature function for dealing with local rule scores (that come from a 00019 // rule table). The scores themselves are stored on TargetPhrase objects 00020 // and the decoder accesses them directly, so this object doesn't really do 00021 // anything except provide somewhere to store the weights and parameter values. 00022 class RuleTableFF : public PhraseDictionary 00023 { 00024 public: 00025 RuleTableFF(const std::string &); 00026 00027 // FIXME Delete m_table? 00028 ~RuleTableFF() {} 00029 00030 void Load(AllOptions::ptr const& opts); 00031 00032 const RuleTable *GetTable() const { 00033 return m_table; 00034 } 00035 00036 static const std::vector<RuleTableFF*> &Instances() { 00037 return s_instances; 00038 } 00039 00040 ChartRuleLookupManager *CreateRuleLookupManager( 00041 const ChartParser &, const ChartCellCollectionBase &, std::size_t) { 00042 assert(false); 00043 return 0; 00044 } 00045 00046 // Get the source terminal vocabulary for this table's grammar (as a set of 00047 // factor IDs) 00048 const boost::unordered_set<std::size_t> &GetSourceTerminalSet() const { 00049 return m_sourceTerminalSet; 00050 } 00051 00052 private: 00053 static std::vector<RuleTableFF*> s_instances; 00054 00055 const RuleTable *m_table; 00056 boost::unordered_set<std::size_t> m_sourceTerminalSet; 00057 }; 00058 00059 } // Syntax 00060 } // Moses