Exemplo n.º 1
0
 public void SubProcAclImdbResultDictEn()
 {
     using (var dbx_src = new FastTextProcessDB(DBF_W2V_EN))
     {
         using (var dbx_dst = new FastTextResultDB(DBF_AclImdb))
         {
             var tran = dbx_dst.BeginTransaction();
             try
             {
                 var  inx_old   = dbx_dst.GetDictInxMax();
                 long inx_check = inx_old.HasValue ? inx_old.Value + 1 : 0;
                 dbx_src.ProcessEmbedJoins((itm) =>
                 {
                     Assert.Equal(inx_check, itm.Inx);
                     dbx_dst.StoreDictItem(itm);
                     inx_check++;
                 }, from_inx: inx_check);
                 tran.Commit();
             }
             catch
             {
                 tran.Rollback();
                 throw;
             }
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Build result DB dictionary
 /// </summary>
 /// <param name="proc_db_fn">Result Db filename</param>
 /// <param name="dbf_w2v_fn">DB word to vector filename</param>
 protected void SubProcBuildResultDict(string proc_db_fn, string dbf_w2v_fn)
 {
     using (var dbx_src = new FastTextProcessDB(dbf_w2v_fn))
     {
         using (var dbx_dst = new FastTextResultDB(proc_db_fn))
         {
             var tran = dbx_dst.BeginTransaction();
             try
             {
                 var  inx_old   = dbx_dst.GetDictInxMax();
                 long inx_check = inx_old.HasValue ? inx_old.Value + 1 : 0;
                 dbx_src.ProcessEmbedJoins((itm) =>
                 {
                     Assert.Equal(inx_check, itm.Inx);
                     dbx_dst.StoreDictItem(itm);
                     inx_check++;
                 }, from_inx: inx_check);
                 tran.Commit();
             }
             catch
             {
                 tran.Rollback();
                 throw;
             }
         }
     }
 }