本文整理汇总了C++中lem::MCollect::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ MCollect::clear方法的具体用法?C++ MCollect::clear怎么用?C++ MCollect::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lem::MCollect
的用法示例。
在下文中一共展示了MCollect::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Lemmatize
void LemmatizatorStorage_SQLITE::Lemmatize(
const lem::UCString &word,
lem::MCollect<lem::UCString> &lemmas
)
{
lemmas.clear();
lem::MemFormatter mem;
mem.printf( "SELECT L.lemma"
" FROM lexemes_n X, lemmas L"
" WHERE X.lexeme='%us' AND L.id=X.id_lemma", to_upper(word).c_str() );
lem::Ptr<LS_ResultSet> rs(cnx->Select(lem::to_utf8(mem.string())));
while( rs->Fetch() )
{
lemmas.push_back( rs->GetUCString(0) );
}
if( lemmas.empty() )
{
lemmas.push_back(word);
}
return;
}
示例2: SelectUnique_WithRemoval
void SynPatternResult::SelectUnique_WithRemoval(lem::MCollect<SynPatternResult*> & results)
{
lem::MCollect<int> result_hash;
lem::PtrCollect<SynPatternResult> unique_result;
for (lem::Container::size_type k = 0; k < results.size(); ++k)
{
SynPatternResult * result_k = results[k];
const int h = result_k->CalcHash();
bool found = false;
for (lem::Container::size_type i = 0; i < unique_result.size(); ++i)
{
if (result_hash[i] == h)
{
if (SynPatternResult::Equals(result_k, unique_result[i]))
{
found = true;
break;
}
}
}
if (!found)
{
result_hash.push_back(h);
unique_result.push_back(result_k);
results[k] = nullptr;
}
}
results.clear();
for (lem::Container::size_type i = 0; i < unique_result.size(); ++i)
{
results.push_back(unique_result[i]);
unique_result[i] = nullptr;
}
return;
}
示例3: Lemmatize
void Lemmatizator::Lemmatize( const lem::UCString &word, lem::MCollect<lem::UCString> &lemmas )
{
lem::UCString res(word);
res.to_upper();
bool rehash=false;
for( int i=0; i<res.length(); ++i )
if( res[i]==0x0401 )
{
res.set( i, 0x0415 );
rehash=true;
}
if( rehash )
res.calc_hash();
// Определяем, в какой группе искать.
const int igroup = (unsigned)res.GetHash16() & (L_NHASHGROUP-1);
const lem::Stream::pos_type pos = group_pos[igroup];
#if defined LEM_THREADS
lem::Process::CritSecLocker lock(&cs);
#endif
// перемещается на начало группы в файле.
bin->seekp(pos);
// перебираем элементы группы в поисках нашей формы.
const int n = bin->read_int();
lem::uint8_t x8[3];
if( char_size==sizeof(wchar_t) )
{
lem::UCString form;
lem::MCollect<int> inorm;
for( int i=0; i<n; ++i )
{
inorm.clear();
lem::Load_Packed( &form, *bin );
lem::uint8_t n8 = bin->read_uint8();
inorm.reserve(n8);
for( lem::uint8_t i8=0; i8<n8; ++i8 )
{
bin->read( x8, 3 );
const int x32 = (0x00ff0000&(x8[0]<<16)) |
(0x0000ff00&(x8[1]<<8)) |
(0x000000ff&x8[2]);
inorm.push_back(x32);
}
if( form==res )
{
// Нашли!!!
for( lem::Container::size_type j=0; j<inorm.size(); ++j )
{
lemmas.push_back( GetLemma(inorm[j]) );
}
return;
}
}
}
else if( char_size==1 )
{
lem::UCString form;
lem::MCollect<int> inorm;
for( int i=0; i<n; ++i )
{
inorm.clear();
LoadEncodedString( &form, *bin, 1 );
lem::uint8_t n8 = bin->read_uint8();
inorm.reserve(n8);
for( lem::uint8_t i8=0; i8<n8; ++i8 )
{
bin->read( x8, 3 );
const int x32 = (0x00ff0000&(x8[0]<<16)) |
(0x0000ff00&(x8[1]<<8)) |
(0x000000ff&x8[2]);
inorm.push_back(x32);
}
if( form==res )
{
// Нашли!!!
for( lem::Container::size_type j=0; j<inorm.size(); ++j )
{
lemmas.push_back( GetLemma(inorm[j]) );
}
return;
}
}
}
else
{
//.........这里部分代码省略.........