00001 #include "HyperParameterAsWeight.h" 00002 #include "moses/StaticData.h" 00003 00004 using namespace std; 00005 00006 namespace Moses 00007 { 00008 00009 HyperParameterAsWeight::HyperParameterAsWeight(const std::string &line) 00010 :StatelessFeatureFunction(2, line) 00011 { 00012 ReadParameters(); 00013 00014 // hack into StaticData and change anything you want 00015 // as an example, we have 2 weights and change 00016 // 1. stack size 00017 // 2. beam width 00018 StaticData &staticData = StaticData::InstanceNonConst(); 00019 00020 vector<float> weights = staticData.GetWeights(this); 00021 00022 staticData.m_options->search.stack_size = weights[0] * 1000; 00023 staticData.m_options->search.beam_width = weights[1] * 10; 00024 00025 } 00026 00027 00028 } 00029