Пример #1
0
/* compute the current binary context */
void ContextTree::getContext(const history_t &h, context_t &context) const {

    context.clear();
    for (size_t i=0; i < m_depth; ++i) {
        context.push_back(h[h.size()-i-1]);
    }
}
Пример #2
0
bool ParseContextMap(const string &str, context_t &context) {
    istringstream iss(str);
    string element;

    while (getline(iss, element, ',')) {
        istringstream ess(element);

        string tok;
        getline(ess, tok, ':');
        domain_t id = (domain_t) stoi(tok);
        getline(ess, tok, ':');
        float w = stof(tok);

        context.push_back(cscore_t(id, w));
    }

    return true;
}