本文整理汇总了C++中Dictionary::GetLexAuto方法的典型用法代码示例。如果您正苦于以下问题:C++ Dictionary::GetLexAuto方法的具体用法?C++ Dictionary::GetLexAuto怎么用?C++ Dictionary::GetLexAuto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dictionary
的用法示例。
在下文中一共展示了Dictionary::GetLexAuto方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Calculate
int TreeScorerResult::Calculate( Dictionary & dict, const TreeScorerBoundVariables & bound_variables ) const
{
if( type==0 )
return score;
else
{
lem::MCollect<const Solarix::Word_Form*> vars;
for( lem::Container::size_type i=0; i<args.size(); ++i )
{
const Solarix::Word_Form * wf = bound_variables.GetVariable( args[i] );
if( wf==NULL )
{
lem::MemFormatter mem;
mem.printf( "tree_scorer: can not find bound variable %us", args[i].c_str() );
throw lem::E_BaseException( mem.string() );
}
vars.push_back(wf);
}
KB_CheckingResult res = dict.GetLexAuto().GetKnowledgeBase().Prove( id_fact, vars );
if( res.IsMatched() )
return res.GetInt();
else
return 0;
}
}
示例3: 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;
}