public void BuildFromStat <TModel>() where TModel : NGramModelBase, new() { var stat = new TextStatistician($"{PATH_BASE}stat.csv"); var model = new TModel(); model.FromStatistician(stat); model.Save(); }
public static void BuildModel(string filePath, IEnumerable <string> modelNames) { var stat = new TextStatistician(filePath); foreach (var modelName in modelNames) { var model = NGramModelFileLoader.NewByName(modelName); model.FromStatistician(stat); model.Save(); } }
public void GetStatistics() { // Arrange var sut = new TextStatistician(); // Act var result = sut.GetStatistics(string.Empty); // Assert var expected = new TextStatisticsStub(0, 0, 0); expected.Should().BeEquivalentTo(result); }
public void GetStatistics_FromTextWith2Hyphens3Spaces4Words() { // Arrange var sut = new TextStatistician(); var text = "Sentence with - Hyphens - Spaces and some Words"; // Act var result = sut.GetStatistics(text); // Assert var expected = new TextStatisticsStub(2, 7, 9); result.Should().BeEquivalentTo(expected); }
public static void QStatistic(string filePath) { if (!File.Exists(filePath)) { Console.WriteLine("File not exist."); return; } var stat = new TextStatistician(filePath); while (true) { Console.Write("stat > "); var input = Console.ReadLine(); int count = stat.GetStringCount(input); Console.WriteLine(count); } }