Esempio n. 1
0
void TextModelIO::readConfig(KyteaConfig & config) {
    string line,s1,s2;
    getline(*str_,line); // ignore the header
    while(getline(*str_, line) && line.length() != 0) {
        istringstream iss(line);
        iss >> s1;
        iss >> s2;
        config.parseTrainArg(s1.c_str(), (s2.length()==0?0:s2.c_str()));
    }
    numTags_ = config.getNumTags();
    
    getline(*str_,line); // check the header
    if(line != "characters") THROW_ERROR("Badly formatted file, expected 'characters', got '" << line << "'");
    getline(*str_, line); // get the serialized string util
    config.getStringUtil()->unserialize(line);
    getline(*str_, line); // check the last line
}