diff options
author | Evgeny Matusov <ematusov@ebay.com> | 2015-11-17 17:16:39 +0300 |
---|---|---|
committer | Evgeny Matusov <ematusov@ebay.com> | 2015-11-17 17:16:39 +0300 |
commit | 5e1340cf63b1e263ff7336075bf791642fd616db (patch) | |
tree | e4dc7e9c73cd8e24ff2598e10c62322ee9892973 /moses/server | |
parent | 66928f682f55cb6e6b105dd71a358354963e91d3 (diff) |
fixed moses server placehoders ; correctly implemented the boolean parameter check function for mosesserver request parameters
Diffstat (limited to 'moses/server')
-rw-r--r-- | moses/server/TranslationRequest.cpp | 13 | ||||
-rw-r--r-- | moses/server/TranslationRequest.h | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/moses/server/TranslationRequest.cpp b/moses/server/TranslationRequest.cpp index 433e37a27..fca1c85a5 100644 --- a/moses/server/TranslationRequest.cpp +++ b/moses/server/TranslationRequest.cpp @@ -264,8 +264,11 @@ bool check(std::map<std::string, xmlrpc_c::value> const& param, std::string const key) { - std::map<std::string, xmlrpc_c::value>::const_iterator m; - return (param.find(key) != param.end()); + std::map<std::string, xmlrpc_c::value>::const_iterator m = param.find(key); + if(m == param.end()) return false; + std::string val = string(xmlrpc_c::value_string(m->second)); + if(val == "true" || val == "True" || val == "TRUE" || val == "1") return true; + return false; } void @@ -369,7 +372,7 @@ run_chart_decoder() void TranslationRequest:: -pack_hypothesis(Moses::Manager& manager, vector<Hypothesis const* > const& edges, string const& key, +pack_hypothesis(const Moses::Manager& manager, vector<Hypothesis const* > const& edges, string const& key, map<string, xmlrpc_c::value> & dest) const { // target string @@ -402,14 +405,14 @@ pack_hypothesis(Moses::Manager& manager, vector<Hypothesis const* > const& edges void TranslationRequest:: -pack_hypothesis(Moses::Manager& manager, Hypothesis const* h, string const& key, +pack_hypothesis(const Moses::Manager& manager, Hypothesis const* h, string const& key, map<string, xmlrpc_c::value>& dest) const { using namespace std; vector<Hypothesis const*> edges; for (; h; h = h->GetPrevHypo()) edges.push_back(h); - pack_hypothesis(edges, key, dest); + pack_hypothesis(manager, edges, key, dest); } diff --git a/moses/server/TranslationRequest.h b/moses/server/TranslationRequest.h index f3984d35a..94d055fd2 100644 --- a/moses/server/TranslationRequest.h +++ b/moses/server/TranslationRequest.h @@ -58,12 +58,12 @@ TranslationRequest : public virtual Moses::TranslationTask run_phrase_decoder(); void - pack_hypothesis(Moses::Manager& manager, std::vector<Moses::Hypothesis const* > const& edges, + pack_hypothesis(const Moses::Manager& manager, std::vector<Moses::Hypothesis const* > const& edges, std::string const& key, std::map<std::string, xmlrpc_c::value> & dest) const; void - pack_hypothesis(Moses::Manager& manager, Moses::Hypothesis const* h, std::string const& key, + pack_hypothesis(const Moses::Manager& manager, Moses::Hypothesis const* h, std::string const& key, std::map<std::string, xmlrpc_c::value> & dest) const; |