public void Contract1_GetCovenantResults_Strategy2() { var path = Path.Combine(TestDataPath, "1.txt"); var text = File.ReadAllText(path); var text1 = @"Sentence 1 Test. Sentence 2. Sentence 3 Test. Sentence 4 Test. Sentence 5. \n"; var textParserService2 = new TextParserService(new PresizeWordsPercentageMathCovenantSearchStrategy()); var result2 = textParserService2.GetCovenantResults(text); foreach (var covenantSearchResult in result2) { text1 = text1.Replace(covenantSearchResult.CovenantValue, $"<mark>{covenantSearchResult.CovenantValue}</mark>"); } using (var sw = new StreamWriter($@"d:\TestCovenant_PercentStrategy_{Guid.NewGuid():N}.html")) { var newText = $@"<html> <body> {text1} </body> </html>"; sw.WriteLine(newText); sw.Flush(); } //Assert.Equal(16, result.Count); //Assert.True(result.All( => .CovenantValue.Length > 3)); //Assert.True(result.All( => .StartIndex < _.EndIndex)); //Assert.True(result.Distinct().Count() == result.Count); }
public void Contract1_GetCovenantResults() { var path = Path.Combine(TestDataPath, "1.txt"); var text = File.ReadAllText(path); var textParserService1 = new TextParserService(new ExactMatchCovenantSearchStrategy()); var result1 = textParserService1.GetCovenantResults(text); var extParserService2 = new TextParserService(new WordsPercentageMatchCovenantSearchStrategy()); var nextResult = extParserService2.GetCovenantResults(text); var result3 = result1.Select(_ => _.StartIndex).Except(nextResult.Select(_ => _.StartIndex)).ToList(); // exact first covenant in documenst var covenantsInOrder = nextResult.OrderBy(x => x.StartIndex).ToArray(); // discuss why we include or exclude some issues var covenant1 = "1.5. Договор вступает в силу с даты подписания сторонами. Срок действия договора устанавливается до 31.08.2019 года.\r"; var covenant2 = "2. РАЗМЕР АРЕНДНОЙ ПЛАТЫ И ПОРЯДОК РАСЧЕТОВ\r"; var covenant3 = "2.1. Сумма ежемесячной арендной платы составляет 2 000 (две тысячи) российских рублей без НДС.. НДС уплачивается в порядке, установленном международными договорами, участниками которых являются Российская Федерация и Республика Беларусь. Расчет стоимости арендной платы прилагается (Приложение №5).\r"; Assert.Equal(covenant1, covenantsInOrder[0].CovenantValue); Assert.Equal(covenant2, covenantsInOrder[1].CovenantValue); Assert.Equal(covenant3, covenantsInOrder[2].CovenantValue); }
private void button_Click(object sender, RoutedEventArgs e) { TextParserService service = new TextParserService(); ResultWindow result = new ResultWindow(service.Parse(textBox.Text)); result.Show(); this.Close(); }
public NameParser(TextParserService textParserService) { this.textParserService = textParserService; this.PIIMask = "NAME"; this.PIIType = PIIType.Low; }