本文整理汇总了C++中Dictionary::GetIO方法的典型用法代码示例。如果您正苦于以下问题:C++ Dictionary::GetIO方法的具体用法?C++ Dictionary::GetIO怎么用?C++ Dictionary::GetIO使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dictionary
的用法示例。
在下文中一共展示了Dictionary::GetIO方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadTxt
void SynPatterns::LoadTxt( Dictionary &dict, lem::Iridium::Macro_Parser & txtfile )
{
lem::Iridium::BSourceState beg = txtfile.tellp();
SynPatternOptions *x = new SynPatternOptions();
x->LoadTxt( dict, txtfile );
if( IsPatternName(x->GetName()) )
{
dict.GetIO().merr().printf( "Patterns group [%us] is already declared\n", x->GetName().c_str() );
lem::Iridium::Print_Error(beg,txtfile);
throw lem::E_BaseException();
}
if( dict.GetLexAuto().GetWordEntrySet().IsSetName(x->GetName()) )
{
dict.GetIO().merr().printf( "%vfC%us%vn is a name of word entry set, word set or collocation set\n", x->GetName().c_str() );
lem::Iridium::Print_Error(beg,txtfile);
throw lem::E_BaseException();
}
const int id = GetNextTreeID();
options.push_back(x);
lem::UCString uname( lem::to_upper(x->GetName() ) );
patterns.insert( std::make_pair( uname, x ) );
name2id.insert( std::make_pair( uname, id ) );
return;
}
示例2: LoadTxt
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;
}
示例3: LoadGroup
void TreeScorers::LoadGroup( Dictionary & dict, lem::Iridium::Macro_Parser &txtfile )
{
lem::Iridium::BethToken t_name = txtfile.read();
lem::UCString gname = t_name.string();
gname.to_upper();
if( name2id.find(gname)!=name2id.end() )
{
lem::Iridium::Print_Error( t_name, txtfile );
dict.GetIO().merr().printf( "Tree scorer group [%us] is already declared\n", t_name.string().c_str() );
throw lem::E_ParserError();
}
TreeScorerGroupParams params;
if( txtfile.probe( B_OFIGPAREN ) )
{
while( !txtfile.eof() )
{
if( txtfile.probe( B_CFIGPAREN ) )
break;
lem::Iridium::BethToken tparam = txtfile.read();
if( tparam.string().eqi(L"allow_unmatched_children") )
{
txtfile.read_it( B_EQUAL );
lem::Iridium::BethToken tbool = txtfile.read();
if( tbool.string().eqi(L"true") )
params.allow_unmatched_children = true;
else if( tbool.string().eqi(L"false") )
params.allow_unmatched_children = false;
else
{
lem::Iridium::Print_Error( tbool, txtfile );
dict.GetIO().merr().printf( "[%us] is not boolean value\n", tbool.string().c_str() );
throw lem::E_ParserError();
}
}
else
{
lem::Iridium::Print_Error( tparam, txtfile );
dict.GetIO().merr().printf( "Unknown tree scorer group parameter [%us]\n", tparam.string().c_str() );
throw lem::E_ParserError();
}
}
}
const int id = storage->StoreTreeScorerGroup( gname, params );
name2id.insert( std::make_pair(gname,id) );
return;
}
示例4: LoadNGram
void LEMM_Compiler::LoadNGram( lem::Iridium::Macro_Parser & txtfile, Dictionary & dict, lem::MCollect<int> & terms, int order ) const
{
lem::Iridium::BSourceState beg = txtfile.tellp();
while( !txtfile.eof() )
{
lem::Iridium::BethToken t = txtfile.read();
if( lem::is_int(t.string()) )
terms.push_back( lem::to_int(t.string()) );
else
{
txtfile.seekp(t);
break;
}
}
if( terms.size() != order+1 )
{
dict.GetIO().merr().printf( "%vfDInvalid ngram%vn\n" );
lem::Iridium::Print_Error( beg, txtfile );
throw lem::E_ParserError();
}
return;
}
示例5: Loaded
void SG_DeclensionTable::Loaded( const Dictionary &dict )
{
if( dict.GetDebugLevel_ir()>=3 )
dict.GetIO().merr().printf( "%vfAOK%vn\n" );
return;
}
示例6: Loaded
void Form_Table::Loaded(const Dictionary &dict)
{
if (dict.GetDebugLevel_ir() >= 3)
dict.GetIO().mecho().printf("%vfAOK%vn\n");
return;
}
示例7: LoadName
/*******************************************************************
Именем таблицы в данном случае является целое неотрицательное число
в десятеричной системе счисления.
********************************************************************/
void SG_DeclensionTable::LoadName(
Macro_Parser &txtfile,
Dictionary &dict
)
{
const BethToken& t = txtfile.read();
key = ANY_STATE;
// Формат:
// paradigma Условное_Имя, Алиас1, ... :
name = t.string();
names.push_back(name);
key = ANY_STATE;
while( !txtfile.eof() && txtfile.pick().GetToken()==B_COMMA )
{
txtfile.read_it(B_COMMA);
names.push_back( txtfile.read().string() );
}
txtfile.read_it(B_COLON);
if( dict.GetDebugLevel_ir()>=3 )
{
dict.GetIO().mecho().printf(
"%us [%vfE%us%vn]->",
sol_get_token(B_PARADIGMA).c_str(),
GetName().c_str()
);
}
return;
}
示例8: LoadTxt
void Alphabets::LoadTxt(lem::Iridium::Macro_Parser &txt, Dictionary &dict)
{
lem::UCString name(txt.read().string());
if (Find(name) != UNKNOWN)
{
dict.GetIO().merr().printf(
"Alphabet [%us] is already declared\n"
, name.c_str()
);
throw E_ParserError();
}
const int id = storage->AddAlphabet(name);
Alphabet *a = new Alphabet(id, name);
a->LoadTxt(txt, dict);
storage->StoreAlphabet(*a);
name2id.insert(std::make_pair(name, id));
id2alphabet.insert(std::make_pair(id, a));
alphabets.push_back(a);
return;
}
示例9: AddForm
void SG_DeclensionTable::AddForm(
const CP_Array &dim,
const WordFormName &form_name,
Dictionary &dict
)
{
try
{
form.push_back( new SG_DeclensionForm(dim,form_name.form_name) );
}
catch( ... )
{
dict.GetIO().merr().printf( "Error in paradigma [%us] syntax\n", GetName().c_str() );
throw E_BaseException();
}
}
示例10: LoadTxt
void LA_Preprocessor::LoadTxt(
const lem::Iridium::BethToken &head_token,
lem::Iridium::Macro_Parser &txtfile,
Dictionary &dict
)
{
if( head_token.string().eqi(L"crop") )
{
LA_CropRule* r = new LA_CropRule();
r->LoadTxt( txtfile, dict );
if( !r->GetName().empty() && storage->FindCropRule(r->GetName())!=UNKNOWN )
{
lem::Iridium::Print_Error( head_token, txtfile );
dict.GetIO().merr().printf( "Rule [%us] redefinition\n", r->GetName().c_str() );
throw E_ParserError();
}
storage->StorePreprocessorCropRule(r);
}
return;
}
示例11: LoadTxt
void SyllabRule::LoadTxt( lem::Iridium::Macro_Parser &txtfile, Dictionary &dict )
{
lem::Iridium::BSourceState point_begin = txtfile.tellp();
id_src = dict.GetDebugSymbols().RegisterLocation( txtfile, point_begin );
// шапка: syllab_rule XXXX language=YYY
name = txtfile.read().string();
txtfile.read_it( B_LANGUAGE );
txtfile.read_it( B_EQUAL );
lem::Iridium::BethToken lang = txtfile.read();
id_language = dict.GetSynGram().Find_Language(lang.string());
if( id_language==UNKNOWN )
{
lem::Iridium::Print_Error(lang,txtfile);
dict.GetIO().merr().printf( "Unknown language name %us\n", lang.c_str() );
throw lem::E_BaseException();
}
txtfile.read_it( B_OFIGPAREN );
txtfile.read_it( B_IF );
txtfile.read_it( B_CONTEXT );
condition.LoadTxt( txtfile, dict );
txtfile.read_it( B_THEN );
txtfile.read_it( B_OFIGPAREN );
txtfile.read_it( B_CONTEXT );
result.LoadTxt( txtfile, dict, condition );
txtfile.read_it( B_CFIGPAREN ); // закрываем блок then { ... }
txtfile.read_it( B_CFIGPAREN ); // закрываем тело правила
return;
}
示例12: LoadTxt
void PatternConstraint::LoadTxt(
Dictionary &dict,
lem::Iridium::Macro_Parser & txtfile,
SynPatternCompilation & compilation_context
)
{
lem::Iridium::BethToken marker_name = txtfile.read();
if( compilation_context.Find(marker_name)==UNKNOWN )
{
dict.GetIO().merr().printf( "Marker [%us] is not declared in this pattern", marker_name.c_str() );
lem::Iridium::Print_Error(marker_name,txtfile);
throw lem::E_BaseException();
}
// ---------------------------
from_marker = marker_name.string();
from_marker.to_upper();
// ---------------------------
txtfile.read_it( B_COLON );
lem::Iridium::BethToken coord_name1 = txtfile.read();
//if( for_group ) txtfile.read_it( B_CSPAREN );
Solarix::GramCoordAdr iglob_coord1 = dict.GetSynGram().FindCoord(coord_name1.string());
if( !iglob_coord1.IsDefined() )
{
dict.GetSynGram().GetIO().merr().printf( "Unknown coordinate %us\n", coord_name1.c_str() );
lem::Iridium::Print_Error(coord_name1,txtfile);
throw lem::E_BaseException();
}
from_coord_id = iglob_coord1.GetIndex();
// ---------------------------
lem::Iridium::BethToken func = txtfile.read();
if( func.GetToken()==B_EQUAL )
constraint_func = EqualFunc;
else if( func.GetToken()==B_LOGNE )
constraint_func = NotEqualFunc;
else
{
dict.GetIO().merr().printf( "Unknown constraint [%us]", func.string().c_str() );
lem::Iridium::Print_Error(func,txtfile);
throw lem::E_BaseException();
}
marker_name = txtfile.read();
if( compilation_context.Find(marker_name)==UNKNOWN )
{
dict.GetIO().merr().printf( "Marker [%us] is not declared in this pattern", marker_name.c_str() );
lem::Iridium::Print_Error(marker_name,txtfile);
throw lem::E_BaseException();
}
to_marker = marker_name.string();
to_marker.to_upper();
// ---------------------------
txtfile.read_it( B_COLON );
lem::Iridium::BethToken coord_name2 = txtfile.read();
//if( for_group ) txtfile.read_it( B_CSPAREN );
Solarix::GramCoordAdr iglob_coord2 = dict.GetSynGram().FindCoord(coord_name2.string());
if( !iglob_coord2.IsDefined() )
{
dict.GetSynGram().GetIO().merr().printf( "Unknown coordinate %us\n", coord_name2.c_str() );
lem::Iridium::Print_Error(coord_name2,txtfile);
throw lem::E_BaseException();
}
to_coord_id = iglob_coord2.GetIndex();
return;
}
示例13: LoadTxt
void SynPatternExport::LoadTxt(
Dictionary &dict,
lem::Iridium::Macro_Parser & txtfile
)
{
txtfile.read_it( B_OFIGPAREN );
while( !txtfile.eof() )
{
bool null_export = txtfile.probe( B_OROUNDPAREN );
lem::Iridium::BethToken coord_name = txtfile.read();
if( coord_name.GetToken()==B_CFIGPAREN )
break;
if( coord_name.string().eqi( L"node" ) )
{
txtfile.read_it( B_COLON );
lem::Iridium::BethToken t_node_name = txtfile.read();
lem::UCString node_name = t_node_name.string();
node_name.to_upper();
if( export_nodes.find(node_name)!=UNKNOWN )
{
dict.GetIO().merr().printf( "Wordform %us is already mentioned in export section\n", t_node_name.string().c_str() );
lem::Iridium::Print_Error(t_node_name,txtfile);
throw lem::E_BaseException();
}
export_nodes.push_back( node_name );
null_export_nodes.push_back( null_export ? 1 : 0 );
if( null_export )
txtfile.read_it( B_CROUNDPAREN );
continue;
}
const GramCoordAdr iglob_coord = dict.GetSynGram().FindCoord(coord_name.string());
if( !iglob_coord.IsDefined() )
{
dict.GetIO().merr().printf( "Unknown coordinate %us\n", coord_name.c_str() );
lem::Iridium::Print_Error(coord_name,txtfile);
throw lem::E_BaseException();
}
if( export_coords.find( iglob_coord.GetIndex() )!=UNKNOWN )
{
dict.GetIO().merr().printf( "Coordinate %us is already mentioned in export section\n", coord_name.c_str() );
lem::Iridium::Print_Error(coord_name,txtfile);
throw lem::E_BaseException();
}
export_coords.push_back(iglob_coord.GetIndex());
null_export_coords.push_back( null_export ? 1 : 0 );
if( null_export )
txtfile.read_it( B_CROUNDPAREN );
}
return;
}
示例14: LoadTxt
void LEMM_Compiler::LoadTxt( lem::Iridium::Macro_Parser & txtfile, Dictionary & dict )
{
txtfile.read_it( B_OFIGPAREN );
while( !txtfile.eof() )
{
lem::Iridium::BethToken t = txtfile.read();
if( t.eqi( L"suffix" ) )
{
int id = txtfile.read_int();
lem::UCString suffix = txtfile.read();
if( suffix[0]==L'"' && suffix.back()==L'"' )
suffix.strip_quotes();
suffices.push_back( std::make_pair(id,suffix) );
}
else if( t.eqi( L"word" ) )
{
int id = txtfile.read_int();
lem::UCString word = txtfile.read();
if( word[0]==L'"' && word.back()==L'"' )
word.strip_quotes();
words.push_back( std::make_pair(id,word) );
}
else if( t.eqi(L"ngram2") )
{
lem::MCollect<int> terms;
LoadNGram(txtfile,dict,terms,2);
LEMM_Ngram2 n2;
n2.tags.first = terms[0];
n2.tags.second = terms[1];
n2.freq = terms[2];
ngram2.push_back(n2);
}
else if( t.eqi(L"ngram2_1") )
{
lem::MCollect<int> terms;
LoadNGram(txtfile,dict,terms,2);
LEMM_Ngram2 n2;
n2.tags.first = terms[0];
n2.tags.second = terms[1];
n2.freq = terms[2];
ngram2_1.push_back(n2);
}
else if( t.eqi(L"ngram3") )
{
lem::MCollect<int> terms;
LoadNGram(txtfile,dict,terms,3);
LEMM_Ngram3 n3;
n3.tags.first = terms[0];
n3.tags.second = terms[1];
n3.tags.third = terms[2];
n3.freq = terms[3];
ngram3.push_back(n3);
}
else if( t.eqi(L"ngram3_1") )
{
lem::MCollect<int> terms;
LoadNGram(txtfile,dict,terms,3);
LEMM_Ngram3 n3;
n3.tags.first = terms[0];
n3.tags.second = terms[1];
n3.tags.third = terms[2];
n3.freq = terms[3];
ngram3_1.push_back(n3);
}
else if( t.eqi(L"ngram3_2") )
{
lem::MCollect<int> terms;
LoadNGram(txtfile,dict,terms,3);
LEMM_Ngram3 n3;
n3.tags.first = terms[0];
n3.tags.second = terms[1];
n3.tags.third = terms[2];
n3.freq = terms[3];
ngram3_2.push_back(n3);
}
else if( t.eqi(L"ngram4") )
{
lem::MCollect<int> terms;
LoadNGram(txtfile,dict,terms,4);
LEMM_Ngram4 n4;
n4.tags.first = terms[0];
n4.tags.second = terms[1];
n4.tags.third = terms[2];
n4.tags.fourth = terms[3];
n4.freq = terms[4];
ngram4.push_back(n4);
}
else if( t.eqi( L"suffix_len" ) )
{
suffix_len = txtfile.read_int();
}
else if( t.GetToken()==B_CFIGPAREN )
break;
else
{
dict.GetIO().merr().printf( "%vfDInvalid statement [%us]%vn\n", t.string().c_str() );
//.........这里部分代码省略.........
示例15: LoadTxt
void SynPattern::LoadTxt(
Dictionary &dict,
lem::Iridium::Macro_Parser & txtfile,
const SynPatterns &patterns,
WordEntrySet &wordentry_set,
const TrProcedureDeclaration &procs,
TrFunctions &functions
)
{
lem::Iridium::BSourceState pattern_beginning = txtfile.tellp();
id_src = dict.GetDebugSymbols().RegisterLocation( txtfile, txtfile.tellp() );
if( dict.GetDebugLevel_ir()>=3 )
{
dict.GetIO().mecho().printf( "pattern " );
}
// ќпционально могут быть заданы целевой ¤зык и опции.
while( !txtfile.eof() )
{
if( txtfile.probe( B_OFIGPAREN ) )
break;
if( txtfile.probe( B_LANGUAGE ) )
{
txtfile.read_it( B_EQUAL );
lem::Iridium::BethToken lang = txtfile.read();
id_language = dict.GetSynGram().Find_Language(lang.string());
if( id_language==UNKNOWN )
{
lem::Iridium::Print_Error(lang,txtfile);
dict.GetIO().merr().printf( "Unknown language name %us\n", lang.c_str() );
throw lem::E_BaseException();
}
}
else if( txtfile.probe( L"incomplete" ) )
{
incomplete=true;
}
else
{
lem::Iridium::BethToken tname = txtfile.read();
name = tname.string();
if( dict.GetDebugLevel_ir()>=3 )
{
dict.GetIO().mecho().printf( "%vfE%us%vn ", name.c_str() );
}
if( !patterns.IsPatternName(name) )
{
dict.GetIO().merr().printf( "Patterns group [%us] is not declared\n", name.c_str() );
lem::Iridium::Print_Error(tname,txtfile);
throw lem::E_BaseException();
}
const SynPatternOptions & group_options = patterns.GetOptions(name);
id_language = group_options.GetLanguageId();
// —екци¤ export { ... } содержит объ¤влени¤ координат, которые паттерн выдает наружу
// —начала попробуем вз¤ть содержимое экспорта по умолчанию, зарегистрированное в объ¤влении
// группы паттернов.
if( txtfile.probe(L"export") )
{
export_info.LoadTxt( dict, txtfile );
}
else
{
const SynPatternOptions & p_options = patterns.GetOptions(name);
export_info = p_options.GetExport();
}
export_info.RegisterExport( *compilation_context );
if( txtfile.probe( B_LANGUAGE ) )
{
txtfile.read_it( B_EQUAL );
lem::Iridium::BethToken lang = txtfile.read();
id_language = dict.GetSynGram().Find_Language(lang.string());
if( id_language==UNKNOWN )
{
lem::Iridium::Print_Error(lang,txtfile);
dict.GetIO().merr().printf( "Unknown language name %us\n", lang.c_str() );
throw lem::E_BaseException();
}
}
txtfile.read_it( B_OFIGPAREN );
break;
}
}
// —писок опорных точек в фигурных скобочках
lem::Iridium::BSourceState beg = txtfile.tellp();
//.........这里部分代码省略.........