void PatternDefaultLinkage::LoadBin( lem::Stream &bin )
{
 optional_node = bin.read_bool();
 bin.read( &marker_name, sizeof(marker_name) );
 bin.read( &node_name, sizeof(node_name) );
 return;
}
Exemple #2
0
void Lemmatizator::LoadString1( lem::CString *str, lem::Stream &bin, int compression )
{
 switch( char_size )
 {
  case 1:
  {
   if( compression==0 )
    {
     bin.read( str->ptr(), lem::CString::max_len );
     str->ptr()[lem::CString::max_len]=0;
    }
   else
    {
     lem::uint8_t len = bin.read_uint8();
     bin.read( str->ptr(), len );
     str->ptr()[len]=0;
    }
   
   str->calc_hash();

   break;
  }

  default:
  {
   LEM_STOPIT;
  }
 }
}
void PatternConstraint::LoadBin( lem::Stream &bin )
{
 bin.read( &from_marker, sizeof(from_marker) );
 bin.read( &to_marker, sizeof(to_marker) );
 from_coord_id = bin.read_int();
 to_coord_id = bin.read_int();
 bin.read( &constraint_func, sizeof(constraint_func) );
 return;
}
Exemple #4
0
void PatternLink::LoadBin( lem::Stream &bin )
{
 bin.read( &from_marker, sizeof(from_marker) );
 bin.read( &from_node, sizeof(from_node) );
 bin.read( &to_marker, sizeof(to_marker) );
 bin.read( &to_node, sizeof(to_node) );
 bin.read( &link_type, sizeof(link_type) );
 optional_to_node = bin.read_bool();
 return;
}
void ModelCodeBook::LoadUtf8( lem::Stream & bin, lem::UCString & str )
{
 lem::uint32_t utf8_len=0;
 bin.read( &utf8_len, sizeof(utf8_len) );

 lem::uint8_t buffer[ lem::UCString::max_len*6+1 ];
 bin.read( buffer, utf8_len );
 buffer[utf8_len] = 0;
 lem::FString u( (const char*)buffer );
 str = lem::UCString(lem::from_utf8(u).c_str());

 return;
}
void LA_WordProjBuffer::LoadBin( lem::Stream &bin )
{
 buffer.LoadBin(bin);
 list.LoadBin(bin);
 bin.read( &nmaxproj,    sizeof(nmaxproj)    );
 bin.read( &n_calls,     sizeof(n_calls)     );
 bin.read( &n_succ,      sizeof(n_succ)      );
 bin.read( &n_succ_prim, sizeof(n_succ_prim) );
 bin.read( &NTOT,        sizeof(NTOT)        );

 bin.read( &use_compiled, sizeof(use_compiled) );
 bin.read( &update_list, sizeof(update_list) );

 return;
}
Exemple #7
0
void Lemmatizator::LoadEncodedString( UCString *str, lem::Stream &bin, int compression )
{
 switch( char_size )
 {
  case 1:
  {
   lem::uint8_t str8[ lem::CString::max_len+1 ];

   if( compression==0 )
    {
     bin.read( str8, lem::CString::max_len );
     str8[lem::CString::max_len]=0;

     int i=0;
     while( str8[i]!=0 )
      {
       str->ptr()[i] = i2wchar[str8[i]];
       ++i;
      }

     str->ptr()[i]=0;
    }
   else
    {
     lem::uint8_t len = bin.read_uint8();
     bin.read( str8, len );
     str8[len]=0;

     for( int i=0; i<len; ++i )
      {
       str->ptr()[i] = i2wchar[str8[i]];
      }

     str->ptr()[len]=0;
    }
   
   str->calc_hash();

   break;
  }

  default:
  {
   LEM_STOPIT;
  }
 }
}
void TreeDimension::LoadBin( lem::Stream &bin )
{
    bin.read( &name, sizeof(name) );
    const int n = bin.read_int();
    for( int i=0; i<n; ++i )
        nodes.push_back( new Tree_Node(bin) );

    return;
}
void TrFun_Lambda::LoadBin( lem::Stream& bin )
{
 TrFunCall::LoadBin(bin);
 ret_type.LoadBin(bin);
 bin.read( &name, sizeof(name) );
 arg_name.LoadBin(bin);
 locals.LoadBin(bin);
 return;
}
void TrFun_CreateWordform::LoadBin( lem::Stream& bin )
{
 TrFunCall::LoadBin(bin);
 ientry.LoadBin(bin);
 coords.LoadBin(bin);
 states.LoadBin(bin);
 bin.read( &form_name, sizeof(form_name) );

 return;
}
Exemple #11
0
void UCStringSet::Load_Packed( lem::Stream &bin )
{
 uint8_t N = 0;
 bin.read( &N, 1 );
 resize( N );

 for( int i=0; i<N; i++ )
  lem::Load_Packed( &(operator[](i)), bin );

 return;
}
Exemple #12
0
/*****************************************************
 Загружает содержимое из указанного бинарного потока.
******************************************************/
void Word_Form::LoadBin( lem::Stream &bin )
{
 bool p=bin.read_bool();
 
 if( p )
  {
   Lexem *m = new Lexem;
   m->LoadBin(bin);
   name = RC_Lexem(m);
  }

 p=bin.read_bool();
 if( p )
  {
   Lexem *m2 = new Lexem;
   m2->LoadBin(bin);
   normalized = RC_Lexem(m2);
  }

// lexem_owner.LoadBin(bin);
// e_list.LoadBin(bin);
 pair.LoadBin(bin);

// bin.read( &tfield,     sizeof(tfield)     );
 bin.read( &entry_key,  sizeof(entry_key)  );
 bin.read( &val,        sizeof(val)        );
 bin.read( &score,        sizeof(score)        );
// bin.read( &icenter,    sizeof(icenter)    );
 bin.read( &origin_pos, sizeof(origin_pos) );

 const int n = bin.read_int();
 alt.reserve(n);
 for( int i=0; i<n; ++i )
  {
   alt.push_back( new Word_Form );
   alt.back()->LoadBin(bin);
  }

 return;
}
Exemple #13
0
void ModelCodeBook::LoadBin( lem::Stream & bin )
{
 lem::uint32_t flags=0;
 bin.read( &flags, sizeof(flags) );

 bin.read( &suffix_len, sizeof(suffix_len) );
 bin.read( &context_size, sizeof(context_size) );

 lem::int32_t undiv_count=-1;
 bin.read( &undiv_count, sizeof(undiv_count) );

 for( int i=0; i<undiv_count; ++i )
  {
   lem::UCString w;
   LoadUtf8( bin, w );
   undividable_words.insert( w );
  }

 lem::uint32_t ntags;
 bin.read( &ntags, sizeof(ntags) );
 for( int i=0; i<ntags; ++i )
  {
   ModelTagMatcher * tag = new ModelTagMatcher();
   tag->LoadBin(bin);
   matchers.push_back(tag);
   id2matcher.insert( std::make_pair( tag->GetId(), tag) );
  }

 lem::int32_t n_suffix;
 bin.read( &n_suffix, sizeof(n_suffix) );
 for( int i=0; i<n_suffix; ++i )
  {
   lem::UCString sfx;
   LoadUtf8( bin, sfx );
   lem::int32_t id;
   bin.read( &id, sizeof(id) );
   suffices.insert( std::make_pair( sfx, id ) );
  }

 bin.read( &START_id, sizeof(START_id) );
 bin.read( &END_id, sizeof(END_id) );

 return;
}
Exemple #14
0
void Tree_Node::LoadBin(lem::Stream &bin)
{
    bin.read(&ilink, sizeof(ilink));

    Word_Form *wf = new Word_Form;
    wf->LoadBin(bin);
    node = boost::shared_ptr<Word_Form>(wf);

    child.LoadBin(bin);
    dims.LoadBin(bin);

    return;
}
Exemple #15
0
void TrFunction::LoadBin( lem::Stream& bin )
{
 bin.read( &name, sizeof(name) );
 ret_type.LoadBin(bin);

 arg_name.LoadBin(bin);
 arg_type.LoadBin(bin);

 if( bin.read_bool() )
  body = TrFunCall::load_bin(bin);

 return;
}
void SG_calibrator::LoadBin(lem::Stream &bin)
{
    freq_type = bin.read_int();

    if (!bin.eof())
    {
        bin.read(&word, sizeof(word));
        id_class = bin.read_int();
        coords.LoadBin(bin);
        freq = bin.read_int();
    }

    return;
}
void ModelTagMatcher::LoadBin( lem::Stream & bin )
{
 bin.read( &id, sizeof(id) );

 ModelCodeBook::LoadUtf8( bin, lexeme );

 lem::int32_t n_lemma;
 bin.read( &n_lemma, sizeof(n_lemma) );
 for( int i=0; i<n_lemma; ++i )
  {
   lem::int32_t e;
   bin.read( &e, sizeof(e) );
   id_lemma.push_back(e);
  }

 lem::int32_t n_pos;
 bin.read( &n_pos, sizeof(n_pos) );
 for( int i=0; i<n_pos; ++i )
  {
   lem::int32_t p;
   bin.read( &p, sizeof(p) );
   pos.push_back(p);
  }

 lem::int32_t n_pair;
 bin.read( &n_pair, sizeof(n_pair) );
 for( int i=0; i<n_pair; ++i )
  {
   lem::int32_t coord_id, state_id;
   bin.read( &coord_id, sizeof(coord_id) );
   bin.read( &state_id, sizeof(state_id) );
   pairs.push_back( Solarix::GramCoordPair( coord_id, state_id ) );
  }

 return;
}
Exemple #18
0
void TrType::LoadBin( lem::Stream& bin )
{
    bin.read( &is_const, sizeof(is_const) );
    bin.read( &type, sizeof(type) );
    return;
}
void ExportCoordFunction_IfContains::LoadBin( lem::Stream & bin )
{
 bin.read(&pair,sizeof(pair));
 return;
}
Exemple #20
0
void SG_LanguageParam::LoadBin(lem::Stream &bin)
{
    bin.read(&name, sizeof(name));
    values.LoadBin(bin);
    return;
}
Exemple #21
0
void LA_ProjList::LoadBin( lem::Stream &bin )
{
 bin.read(&Char,sizeof(Char));
 Collect<LA_WordProjection>::LoadBin(bin);
 return;
}
void WordEntries_File::LoadBin(lem::Stream &bin)
{
    ml_ref.LoadBin(bin);

    Delete_Entries();

    entry_pos.clear();

    coord_ref.LoadBin(bin);

    /*
     LEM_CHECKIT_Z( group.empty() );
     const int n_group = bin.read_int();
     for( int i=0; i<n_group; ++i )
      {
       SG_EntryGroup *g = new SG_EntryGroup(bin);
       group.insert( std::make_pair( g->GetKey(), g ) );
      }
    */
    lookup_table.LoadBin(bin);

    /*
    // #if LEM_DEBUGGING==1
     lem::mout->eol();
     for( int kkk=0; kkk<lookup_table.lexem_slot.size(); ++kkk )
      {
       WordEntries_LookUpItem xxx = lookup_table.lexem_slot[kkk];
       lem::mout->printf( "x[%d]=%d,%d ", kkk, xxx.start_index, xxx.len );
      }
     lem::mout->eol();
    // #endif
    */

    ientry.LoadBin(bin);

    u_entry.LoadBin(bin);

    ML_entry_key_list.LoadBin(bin);
    ML_entry_lex_list.LoadBin(bin);
    ML_entry_pre_list.LoadBin(bin);

    bin.read(&max_ml_len, sizeof(max_ml_len));
    bin.read(predefined_entry, sizeof(predefined_entry));

    const int n_entry = bin.read_int();
    entry.resize(n_entry);

    // загрузили все обязательные данные, теперь опциональная загрузка.
    lem::Stream::pos_type epos_begin_pos = 0;
    lem::Stream::pos_type entries_begin_pos = 0;
    lem::Stream::pos_type end_pos = 0;

    bin.read(&epos_begin_pos, sizeof(epos_begin_pos));
    bin.read(&entries_begin_pos, sizeof(entries_begin_pos));
    bin.read(&end_pos, sizeof(end_pos));

    if (lazy_load)
    {
        // статьи пока не загружаем.

        entry.Nullify();

        // прочитаем только список позиций начала каждой статьи.
        bin.seekp(epos_begin_pos);
        entry_pos.LoadBin(bin);

        lem::MCollect< std::pair<int, int> > key_to_index_tmp;
        key_to_index_tmp.LoadBin(bin);
        for (lem::Container::size_type i = 0; i < key_to_index_tmp.size(); ++i)
            key_to_index.insert(key_to_index_tmp[i]);

        lem::MCollect<Lexem> ML_tmp;
        ML_tmp.LoadBin(bin);
        for (lem::Container::size_type i = 0; i < ML_tmp.size(); ++i)
            ML_fronts.insert(ML_tmp[i]);

        ML_tmp.LoadBin(bin);
        for (lem::Container::size_type i = 0; i < ML_tmp.size(); ++i)
            ML_ML.insert(ML_tmp[i]);
    }
    else
    {
        bin.seekp(entries_begin_pos);

        entry_pos.clear();

        // список словарных статей загружаем сразу целиком в память.
        for (int i0 = 0; i0 < n_entry; i0++)
        {
            entry[i0] = new SG_Entry;
            entry[i0]->LoadBin(bin);

            if (entry[i0] != bogus_entry)
                entry[i0]->ReattachToRefs(*sg);
        }

        for (lem::Container::size_type ie = 0; ie < entry.size(); ie++)
        {
            key_to_index.insert(std::make_pair(entry[ientry[ie]]->GetKey(), ie));
        }

        coord_ref.AllAttached();

#if defined SOL_LOADTXT && defined SOL_COMPILER
        for (lem::Container::size_type k = 0; k < entry.size(); ++k)
        {
            const SG_Entry & e = GetWordEntry(k);
            entry_class_lookup.insert(std::make_pair(std::make_pair(lem::to_upper(e.GetName()), e.GetClass()), e.GetKey()));
    }
#endif

        for (lem::Container::size_type i = 0; i < ML_entry_key_list.size(); ++i)
        {
            const int ik = ML_entry_key_list[i];
            const SG_Entry &e = GetEntryByKey(ik);

            for (lem::Container::size_type j = 0; j < e.forms().size(); ++j)
            {
                const Lexem & form = e.forms()[j].name();

                if (form.Count_Lexems() > 1)
                {
                    UCStringSet list;
                    form.Split(list);
                    ML_fronts.insert(list.front());
                    ML_ML.insert(form);
                }
            }
        }
}

    bin.seekp(end_pos);

    return;
}
Exemple #23
0
void TrFun_Var::LoadBin( lem::Stream& bin )
{
    TrFunCall::LoadBin(bin);
    bin.read( &var_name, sizeof(var_name) );
    return;
}