当前位置: 首页>>代码示例>>C#>>正文


C# BinarySerializer.Close方法代码示例

本文整理汇总了C#中BinarySerializer.Close方法的典型用法代码示例。如果您正苦于以下问题:C# BinarySerializer.Close方法的具体用法?C# BinarySerializer.Close怎么用?C# BinarySerializer.Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BinarySerializer的用法示例。


在下文中一共展示了BinarySerializer.Close方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CategorizerDemo

 static CategorizerDemo()
 {
     string fileName = HttpContext.Current.Server.MapPath("App_Data\\model.bin");
     BinarySerializer binReader = new BinarySerializer(fileName, FileMode.Open);
     mBowSpace = new BowSpace(binReader);
     mBowSpace.CutLowWeightsPerc = 0.2;
     mCategorizer = Utils.LoadDictionary<string, IModel<string>>(binReader);
     binReader.Close();
     mReady = true;
 }
开发者ID:project-first,项目名称:documentcategorizerdemo,代码行数:10,代码来源:CategorizerDemo.aspx.cs

示例2: TwitterSentimentDemo

 static TwitterSentimentDemo()
 {
     string modelFileName = HttpContext.Current.Server.MapPath("App_Data\\AdCfy.bin");
     string bowSpcFileName = HttpContext.Current.Server.MapPath("App_Data\\AdCfyBowSpc.bin");
     mClassifier = new SvmBinaryClassifier<int>();
     mClassifier.LoadModel(modelFileName);
     BinarySerializer bs = new BinarySerializer(bowSpcFileName, FileMode.Open);
     mBowSpace = new BowSpace(bs);
     bs.Close();
     mReady = true;
 }
开发者ID:project-first,项目名称:pumpanddumpclassifierdemo,代码行数:11,代码来源:PumpAndDumpDemo.aspx.cs

示例3: DocumentCategorizerComponent

 static DocumentCategorizerComponent()
 {
     Logger.GetLogger(typeof(DocumentCategorizerComponent)).Info("CategorizerComponent", "Loading model ...");
     string fileName = Utils.GetConfigValue("CategorizationModel", ".\\CategorizationModel.bin");
     BinarySerializer binReader = new BinarySerializer(fileName, FileMode.Open);
     mBowSpace = new BowSpace(binReader);
     mBowSpace.CutLowWeightsPerc = 0.2;
     mCategorizer = Utils.LoadDictionary<string, IModel<string>>(binReader);
     binReader.Close();
     //using (BinarySerializer writer = new BinarySerializer(@"C:\Work\AchimPipe\DocumentCategorizerModel.bin", FileMode.Create))
     //{
     //    mBowSpace.Save(writer);
     //    Utils.SaveDictionary<string, IModel<string>>(mCategorizer, writer);
     //}
     Logger.GetLogger(typeof(DocumentCategorizerComponent)).Info("CategorizerComponent", "Done.");
 }
开发者ID:project-first,项目名称:monitorpipeline,代码行数:16,代码来源:DocumentCategorizerComponent.cs

示例4: Main

 static void Main(string[] args)
 {
     LanguageDetector langDet = LanguageDetector.GetLanguageDetectorPrebuilt();
     //LanguageDetector langDet = new LanguageDetector();
     //langDet.ReadCorpus(@"C:\Users\mIHA\Desktop\langdet");
     LanguageProfile p = langDet.FindMatchingLanguage("To je slovenski stavek. Čeprav ga naš detektor ne zazna pravilno. Mogoče šumniki pomagajo...");
     Console.WriteLine(p.Language);
     p = langDet.FindMatchingLanguage("I love you.");
     Console.WriteLine(p.Language);
     p = langDet.FindMatchingLanguage("Baš te volim.");
     Console.WriteLine(p.Language);
     p = langDet.FindMatchingLanguage("Je t'aime.");
     Console.WriteLine(p.Language);
     foreach (LanguageProfile pr in langDet.LanguageProfiles)
     {
         BinarySerializer ser = new BinarySerializer(string.Format(@"C:\Users\mIHA\Desktop\langdet\{0}.ldp", pr.Language), FileMode.Create);
         pr.Save(ser);
         ser.Close();
     }
     //Console.WriteLine(langDet.GetLanguageProfile("et"));
     //StreamWriter w = new StreamWriter("c:\\krneki\\langSim.txt");
     //foreach (LanguageProfile p in langDet.LanguageProfiles)
     //{
     //    w.Write("{0}\t", p.Code);
     //}
     //w.WriteLine();
     //foreach (LanguageProfile p in langDet.LanguageProfiles)
     //{
     //    foreach (LanguageProfile p2 in langDet.LanguageProfiles)
     //    {
     //        //w.Write("{0}\t", Math.Max(p.CalcSpearman(p2), p2.CalcSpearman(p)));
     //    }
     //    w.WriteLine();
     //}
     //w.Close();
 }
开发者ID:viidea,项目名称:latino,代码行数:36,代码来源:Program2.cs

示例5: GetLanguageDetectorPrebuilt

 public static LanguageDetector GetLanguageDetectorPrebuilt()
 {
     LanguageDetector ld = new LanguageDetector();
     Assembly assembly = Assembly.GetExecutingAssembly();
     foreach (string resName in assembly.GetManifestResourceNames())
     {
         if (resName.EndsWith(".ldp"))
         {
             // load language detector profile
             BinarySerializer ser = new BinarySerializer(assembly.GetManifestResourceStream(resName));
             LanguageProfile langProfile = new LanguageProfile(ser);
             ser.Close();
             ld.AddLanguageProfile(langProfile);
             mLogger.Debug("GetLanguageDetectorPrebuilt", "Loaded resource {0}.", resName);
         }
     }
     return ld;
 }
开发者ID:project-first,项目名称:latino,代码行数:18,代码来源:LanguageDetector.cs


注:本文中的BinarySerializer.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。