Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                // Загружаем все данные.
                DataController data = new DataController(openFileDialog.FileName);

                // Нормализируем все данные.
                WorkModel clearedManuscript = new WorkModel(DataController.Manuscript.AuthorName, TextNormalisation.ClearText(DataController.Manuscript.Text));
                List<WorkModel> clearedBooks = new List<WorkModel>();
                foreach (WorkModel book in DataController.Books)
                    clearedBooks.Add(new WorkModel(book.AuthorName, TextNormalisation.ClearText(book.Text)));

                // Сравниваем тексты.
                TextComparison textComparison = new TextComparison(clearedManuscript, clearedBooks);
                List<CopiedFragmentModel> copiedFragments = textComparison.CopiedText;

                // Выводим денормализированные данные.
                ReportSaver.SaveReport(copiedFragments, DataController.Manuscript.AuthorName);
            }

            this.Close();
        }
 public static List<CopiedFragmentModel> DenormaliseText(List<CopiedFragmentModel> copiedFragments, List<WorkModel> clearedBooks, TextComparison textComparison)
 {
     for (int i = 0; i < copiedFragments.Count; i++)
     {
         WorkModel book = DataController.Books.Find(x => x.AuthorName == copiedFragments[i].AuthorName);
         WorkModel clearedBook = clearedBooks.Find(x => x.AuthorName == copiedFragments[i].AuthorName);
         List<int> conformity = TextDenormalisation.СonformityPeace(book.Text, clearedBook.Text);
         for (int j = 0; j < copiedFragments[i].Texts.Count; j++)
         {
             copiedFragments[i].Texts[j] = TextDenormalisation.CreateFullText(conformity, new List<Result>(new Result[] { textComparison.Results[i][j] }), book.Text, 6)[0];
         }
     }
     return copiedFragments;
 }