예제 #1
0
 public void SubProcFillEmptyVectDictEn()
 {
     using (var dbx = new FastTextProcessDB(DBF_W2V_EN))
     {
         var words = dbx.Dict(DictDbSet.DictKind.Addin).GetWordsWithEmptyVect();
         if (words.Any())
         {
             var fmod = DataArcPath("cc.en.300.bin");
             AssertFileExists(fmod, "FastText model file");
             var fexe = FastTextBin;
             AssertFileExists(fexe, "FastText executable");
             var trans = dbx.BeginTransaction();
             try
             {
                 var dict = dbx.Dict(DictDbSet.DictKind.Addin);
                 using (var ftl = new FastTextLauncher(fexe, fmod))
                 {
                     ftl.RunAsync((w2v) => dict.UpdateVectOfWord(w2v));
                     foreach (var w in words)
                     {
                         ftl.Push(w);
                     }
                 }
                 trans.Commit();
             }
             catch
             {
                 trans.Rollback();
                 throw;
             }
         }
     }
 }
예제 #2
0
 public CommonEnCyr(FastTextLauncher ft_lang_detector, bool to_lower = true)
 {
     _ftLangDetector = ft_lang_detector;
     _toLower        = to_lower;
 }
예제 #3
0
 public CommonEnCyr(FastTextLauncher ft_launcher, bool to_lower = true)
 {
     _ftLauncher = ft_launcher;
     _toLower    = to_lower;
 }