void hts_engine_call::set_input() { event_mask events_of_interest=player.get_supported_events(); const relation& event_rel=utt.get_relation("Event"); const relation& seg_rel=utt.get_relation("Segment"); const relation& tokstruct_rel=utt.get_relation("TokStructure"); relation::const_iterator seg_start=seg_rel.begin(); relation::const_iterator seg_end=seg_start; if((!tokstruct_rel.empty())&&(events_of_interest&event_sentence_starts)) input.add_event<sentence_starts_event>(utt); for(relation::const_iterator event_iter=event_rel.begin();event_iter!=event_rel.end();++event_iter) { if(event_iter->in("Token")) { const item& token=event_iter->as("Token"); if(token.has_children()) { seg_end=token.first_child().as("Transcription").first_child().as("Segment").get_iterator(); add_labels(seg_start,seg_end); seg_start=seg_end; } if(events_of_interest&event_word_starts) input.add_event<word_starts_event>(token); if(token.has_children()) { seg_end=++(token.last_child().as("Transcription").last_child().as("Segment").get_iterator()); add_labels(seg_start,seg_end); seg_start=seg_end; } if(events_of_interest&event_word_ends) input.add_event<word_ends_event>(token); if(token.has_children()&&seg_end!=seg_rel.end()&&seg_end->get("name").as<std::string>()=="pau") { add_label(*seg_end); ++seg_end; seg_start=seg_end; } } else if(events_of_interest&event_mark) { const value& v=event_iter->get("mark",true); if(!v.empty()) input.add_event<mark_event>(v.as<std::string>()); } else if(events_of_interest&event_audio) { const value& v=event_iter->get("audio",true); if(!v.empty()) input.add_event<audio_event>(v.as<std::string>()); } } add_labels(seg_start,seg_rel.end()); if((!tokstruct_rel.empty())&&(events_of_interest&event_sentence_ends)) input.add_event<sentence_ends_event>(utt); engine_impl->set_input(input); }
void mesos::add_tasks_impl(mesos_framework& framework, const Json::Value& tasks) { if(!tasks.isNull()) { for(const auto& task : tasks) { std::string name, uid, sid; Json::Value fname = task["name"]; if(!fname.isNull()) { name = fname.asString(); } Json::Value fid = task["id"]; if(!fid.isNull()) { uid = fid.asString(); } Json::Value fsid = task["slave_id"]; if(!fsid.isNull()) { sid = fsid.asString(); } std::ostringstream os; os << "Adding Mesos task: [" << framework.get_name() << ':' << name << ',' << uid << ']'; g_logger.log(os.str(), sinsp_logger::SEV_DEBUG); std::shared_ptr<mesos_task> t(new mesos_task(name, uid)); t->set_slave_id(sid); add_labels(t, task); m_state.add_or_replace_task(framework, t); } } else { g_logger.log("tasks is null", sinsp_logger::SEV_DEBUG); } }