void TreeScorerResult::LoadBoundVars( Dictionary & dict, lem::Iridium::Macro_Parser & txtfile, const TreeScorerMarkers & markers ) { txtfile.read_it( B_OROUNDPAREN ); while( !txtfile.eof() ) { if( txtfile.probe( B_CROUNDPAREN ) ) break; if( !args.empty() ) txtfile.read_it( B_COMMA ); const lem::Iridium::BethToken & var = txtfile.read(); lem::UCString upper_var = lem::to_upper(var.string()); if( !markers.IsAlreadyBound(upper_var) ) { lem::Iridium::Print_Error(var,txtfile); dict.GetIO().merr().printf( "Variable %us is not bound\n", var.string().c_str() ); throw lem::E_BaseException(); } args.push_back( upper_var ); } return; }
void TreeScorerResult::LoadTxt( Dictionary & dict, lem::Iridium::Macro_Parser & txtfile, const TreeScorerMarkers & markers ) { // ќценка может быть отрицательной. if( txtfile.probe( B_SUB ) ) { type=0; score = -txtfile.read_int(); } else { if( lem::is_int( txtfile.pick().string() ) ) { type=0; score = txtfile.read_int(); } else { const lem::Iridium::BethToken & t = txtfile.read(); id_fact = dict.GetLexAuto().GetKnowledgeBase().FindFacts( t.string() ); if( id_fact==UNKNOWN ) { // todo - тут могут быть другие варианты вызываемых вычислений. lem::Iridium::Print_Error(t,txtfile); dict.GetIO().merr().printf( "Unknown scoring expression starts with %us\n", t.string().c_str() ); throw lem::E_BaseException(); } txtfile.read_it( B_OROUNDPAREN ); while( !txtfile.eof() ) { if( txtfile.probe( B_CROUNDPAREN ) ) break; if( !args.empty() ) txtfile.read_it( B_COMMA ); const lem::Iridium::BethToken & var = txtfile.read(); lem::UCString upper_var = lem::to_upper(var.string()); if( !markers.IsAlreadyBound(upper_var) ) { lem::Iridium::Print_Error(var,txtfile); dict.GetIO().merr().printf( "variable %us not bound\n", var.string().c_str() ); throw lem::E_BaseException(); } args.push_back( upper_var ); } type=1; } } return; }