2015-10-23 20:33:12 +03:00
|
|
|
/*
|
2015-10-26 00:20:55 +03:00
|
|
|
* System.cpp
|
2015-10-23 20:33:12 +03:00
|
|
|
*
|
|
|
|
* Created on: 23 Oct 2015
|
|
|
|
* Author: hieu
|
|
|
|
*/
|
2015-10-27 18:46:37 +03:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <boost/foreach.hpp>
|
2015-10-26 00:20:55 +03:00
|
|
|
#include "System.h"
|
2015-10-27 18:46:37 +03:00
|
|
|
#include "FeatureFunction.h"
|
2015-10-24 04:02:50 +03:00
|
|
|
#include "moses/Util.h"
|
2015-10-27 18:46:37 +03:00
|
|
|
#include "util/exception.hh"
|
|
|
|
|
|
|
|
using namespace std;
|
2015-10-23 20:33:12 +03:00
|
|
|
|
2015-10-27 18:46:37 +03:00
|
|
|
System::System(const Moses::Parameter ¶ms)
|
2015-10-27 19:54:15 +03:00
|
|
|
:m_featureFunctions(*this)
|
2015-10-27 18:46:37 +03:00
|
|
|
,m_params(params)
|
|
|
|
{
|
2015-10-27 19:54:15 +03:00
|
|
|
m_featureFunctions.LoadFeatureFunctions();
|
|
|
|
LoadWeights();
|
2015-10-27 18:46:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
System::~System() {
|
|
|
|
}
|
|
|
|
|
2015-10-27 19:54:15 +03:00
|
|
|
void System::LoadWeights()
|
2015-10-24 14:39:15 +03:00
|
|
|
{
|
2015-10-27 19:54:15 +03:00
|
|
|
const Moses::PARAM_VEC *weightParams = m_params.GetParam("weight");
|
|
|
|
UTIL_THROW_IF2(weightParams == NULL, "Must have [weight] section");
|
2015-10-27 18:46:37 +03:00
|
|
|
|
2015-10-27 19:54:15 +03:00
|
|
|
BOOST_FOREACH(const std::string &line, *weightParams) {
|
2015-10-27 20:35:42 +03:00
|
|
|
m_weights.CreateFromString(m_featureFunctions, line);
|
2015-10-27 18:46:37 +03:00
|
|
|
}
|
2015-10-27 19:54:15 +03:00
|
|
|
}
|
2015-10-27 18:46:37 +03:00
|
|
|
|
|
|
|
|
2015-10-24 15:19:42 +03:00
|
|
|
|