mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-11-10 10:59:21 +03:00
30 lines
607 B
C++
30 lines
607 B
C++
#include "HyperParameterAsWeight.h"
|
|
#include "moses/StaticData.h"
|
|
|
|
using namespace std;
|
|
|
|
namespace Moses
|
|
{
|
|
|
|
HyperParameterAsWeight::HyperParameterAsWeight(const std::string &line)
|
|
:StatelessFeatureFunction(2, line)
|
|
{
|
|
ReadParameters();
|
|
|
|
// hack into StaticData and change anything you want
|
|
// as an example, we have 2 weights and change
|
|
// 1. stack size
|
|
// 2. beam width
|
|
StaticData &staticData = StaticData::InstanceNonConst();
|
|
|
|
vector<float> weights = staticData.GetWeights(this);
|
|
|
|
staticData.m_maxHypoStackSize = weights[0] * 1000;
|
|
staticData.m_beamWidth = weights[1] * 10;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|