mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
Change parameters only when specified during parameter updates in server mode.
This commit is contained in:
parent
6f1e39d64e
commit
a074efc7cc
@ -43,7 +43,7 @@ update(std::map<std::string,xmlrpc_c::value>const& param)
|
||||
params_t::const_iterator si = param.find("nbest");
|
||||
if (si != param.end())
|
||||
nbest_size = xmlrpc_c::value_int(si->second);
|
||||
only_distinct = check(param, "nbest-distinct");
|
||||
only_distinct = check(param, "nbest-distinct", only_distinct);
|
||||
enabled = (nbest_size > 0);
|
||||
return true;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
// -*- mode: c++; indent-tabs-mode: nil; tab-width:2 -*-
|
||||
#include "OptionsBaseClass.h"
|
||||
#include "moses/Util.h"
|
||||
|
||||
namespace Moses {
|
||||
|
||||
#ifdef HAVE_XMLRPC_C
|
||||
@ -15,10 +17,12 @@ namespace Moses {
|
||||
bool
|
||||
OptionsBaseClass::
|
||||
check(std::map<std::string, xmlrpc_c::value> const& param,
|
||||
std::string const key)
|
||||
std::string const key, bool dfltval)
|
||||
{
|
||||
std::map<std::string, xmlrpc_c::value>::const_iterator m;
|
||||
return (param.find(key) != param.end());
|
||||
m = param.find(key);
|
||||
if (m == param.end()) return dfltval;
|
||||
return Scan<bool>(xmlrpc_c::value_string(m->second));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ namespace Moses
|
||||
#endif
|
||||
bool
|
||||
check(std::map<std::string, xmlrpc_c::value> const& param,
|
||||
std::string const key);
|
||||
std::string const key, bool dfltval);
|
||||
};
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ namespace Moses {
|
||||
ReportingOptions::
|
||||
update(std::map<std::string, xmlrpc_c::value>const& param)
|
||||
{
|
||||
ReportAllFactors = check(param, "report-all-factors");
|
||||
ReportAllFactors = check(param, "report-all-factors", ReportAllFactors);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user