本文整理汇总了C++中params_t::end方法的典型用法代码示例。如果您正苦于以下问题:C++ params_t::end方法的具体用法?C++ params_t::end怎么用?C++ params_t::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类params_t
的用法示例。
在下文中一共展示了params_t::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: merge_params
// for each key/value in params_one, set params_two[key] = value
void merge_params(params_t& params_one, params_t& params_two) {
map<string,string>::iterator iter;
for(iter = params_one.begin(); iter != params_one.end(); iter++) {
string param_key(iter->first);
params_two[param_key] = params_one[param_key];
}
};
示例2: fault
void
execute(xmlrpc_c::paramList const& paramList,
xmlrpc_c::value * const retvalP) {
#ifdef WITH_DLIB
const params_t params = paramList.getStruct(0);
params_t::const_iterator si = params.find("model_name");
if (si == params.end()) {
throw xmlrpc_c::fault(
"Missing name of model to be optimized (e.g. PhraseDictionaryMultiModelCounts0)",
xmlrpc_c::fault::CODE_PARSE);
}
const string model_name = xmlrpc_c::value_string(si->second);
PhraseDictionaryMultiModel* pdmm = (PhraseDictionaryMultiModel*) FindPhraseDictionary(model_name);
si = params.find("phrase_pairs");
if (si == params.end()) {
throw xmlrpc_c::fault(
"Missing list of phrase pairs",
xmlrpc_c::fault::CODE_PARSE);
}
vector<pair<string, string> > phrase_pairs;
xmlrpc_c::value_array phrase_pairs_array = xmlrpc_c::value_array(si->second);
vector<xmlrpc_c::value> phrasePairValueVector(phrase_pairs_array.vectorValueValue());
for (size_t i=0; i < phrasePairValueVector.size(); i++) {
xmlrpc_c::value_array phrasePairArray = xmlrpc_c::value_array(phrasePairValueVector[i]);
vector<xmlrpc_c::value> phrasePair(phrasePairArray.vectorValueValue());
string L1 = xmlrpc_c::value_string(phrasePair[0]);
string L2 = xmlrpc_c::value_string(phrasePair[1]);
phrase_pairs.push_back(make_pair(L1,L2));
}
vector<float> weight_vector;
weight_vector = pdmm->MinimizePerplexity(phrase_pairs);
vector<xmlrpc_c::value> weight_vector_ret;
for (size_t i=0; i < weight_vector.size(); i++) {
weight_vector_ret.push_back(xmlrpc_c::value_double(weight_vector[i]));
}
*retvalP = xmlrpc_c::value_array(weight_vector_ret);
#else
string errmsg = "Error: Perplexity minimization requires dlib (compilation option --with-dlib)";
cerr << errmsg << endl;
*retvalP = xmlrpc_c::value_string(errmsg);
#endif
}
示例3: breakOutParams
void breakOutParams(const params_t& params) {
params_t::const_iterator si = params.find("source");
if(si == params.end())
throw xmlrpc_c::fault("Missing source sentence", xmlrpc_c::fault::CODE_PARSE);
source_ = xmlrpc_c::value_string(si->second);
cerr << "source = " << source_ << endl;
si = params.find("target");
if(si == params.end())
throw xmlrpc_c::fault("Missing target sentence", xmlrpc_c::fault::CODE_PARSE);
target_ = xmlrpc_c::value_string(si->second);
cerr << "target = " << target_ << endl;
si = params.find("alignment");
if(si == params.end())
throw xmlrpc_c::fault("Missing alignment", xmlrpc_c::fault::CODE_PARSE);
alignment_ = xmlrpc_c::value_string(si->second);
cerr << "alignment = " << alignment_ << endl;
si = params.find("bounded");
bounded_ = (si != params.end());
si = params.find("updateORLM");
add2ORLM_ = (si != params.end());
}
示例4: get_extension_params
void get_extension_params(params_t& extparams, params_t& params) {
map<string,string>::iterator iter;
extparams.reset_fields();
for(iter = params.begin(); iter != params.end(); iter++) {
string param_key(iter->first);
vector<string> parts = explode(param_key, ".");
// if there is more than one "." in the param name then we're
// dealing with an extension parameter
if(parts.size() > 2)
extparams[param_key] = params[param_key];
}
};
示例5: remove_openid_vars
void remove_openid_vars(params_t& params) {
map<string,string>::iterator iter, iter_next;
for(iter = params.begin(); iter != params.end(); ) {
iter_next = iter;
++iter_next;
string param_key(iter->first);
// if starts with openid. or modauthopenid. (for the nonce) or openid_identifier (the login) remove it
if((param_key.substr(0, 7) == "openid." || param_key.substr(0, 14) == "modauthopenid." || param_key == "openid_identifier")) {
params.erase(iter); // invalidates iter, but its successor iter_next is still valid
}
iter = iter_next;
}
};
示例6: remove_openid_vars
void remove_openid_vars(params_t& params) {
map<string,string>::iterator iter;
for(iter = params.begin(); iter != params.end(); iter++) {
string param_key(iter->first);
// if starts with openid. or modauthopenid. (for the nonce) or openid_identifier (the login) remove it
if((param_key.substr(0, 7) == "openid." || param_key.substr(0, 14) == "modauthopenid." || param_key == "openid_identifier")) {
params.erase(param_key);
// stupid map iterator screws up if we just continue the iteration...
// so recursion to the rescue - we'll delete them one at a time
remove_openid_vars(params);
return;
}
}
};