public static ILanguageModel LoadModel(string file, int version) { ILanguageModel model = ModelFactory.CreateModelByVersion(version); using (BinaryReader br = new BinaryReader(File.OpenRead(file))) { model.ReadFromBinary(br); } return(model); }
static void EvaluateModels(int modelVersion, string modelFilePattern) { var models = new List <ILanguageModel>(); string[] modelFiles = Directory.GetFiles(basePath, modelFilePattern); for (int i = 0; i < modelFiles.Length; i++) { using (BinaryReader br = new BinaryReader(File.OpenRead(modelFiles[i]))) { ILanguageModel model = ModelFactory.CreateModelByVersion(modelVersion); model.ReadFromBinary(br); models.Add(model); } } var converter = new Utility.VietConverter(); Trainer.TestTestingSet(models, converter); Trainer.TestUserQuery(models, converter); }