mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-08 04:27:53 +03:00
40 lines
739 B
C++
40 lines
739 B
C++
/*
|
|
* System.cpp
|
|
*
|
|
* Created on: 23 Oct 2015
|
|
* Author: hieu
|
|
*/
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <boost/foreach.hpp>
|
|
#include "System.h"
|
|
#include "FeatureFunction.h"
|
|
#include "moses/Util.h"
|
|
#include "util/exception.hh"
|
|
|
|
using namespace std;
|
|
|
|
System::System(const Moses::Parameter ¶ms)
|
|
:m_featureFunctions(*this)
|
|
,m_params(params)
|
|
{
|
|
m_featureFunctions.LoadFeatureFunctions();
|
|
LoadWeights();
|
|
}
|
|
|
|
System::~System() {
|
|
}
|
|
|
|
void System::LoadWeights()
|
|
{
|
|
const Moses::PARAM_VEC *weightParams = m_params.GetParam("weight");
|
|
UTIL_THROW_IF2(weightParams == NULL, "Must have [weight] section");
|
|
|
|
BOOST_FOREACH(const std::string &line, *weightParams) {
|
|
m_weights.CreateFromString(m_featureFunctions, line);
|
|
}
|
|
}
|
|
|
|
|
|
|