Пример #1
0
        private async Task SearchForPlagiarismInWeb(string fileName)
        {
            richTextBox1.Text = string.Empty;
            textBox2.Text     = string.Empty;

            var simplifiedText = TextDocumentManager.SimplifiedTextFromFile(fileName);

            var plagiarismInWeb = await PlagiarismInWebFinder.Find(simplifiedText);

            richTextBox1.Text += simplifiedText + Environment.NewLine;
            richTextBox1.Text += $"Words count: {plagiarismInWeb.WordCount}" + Environment.NewLine;
            ShowUrlToWordIndexes(plagiarismInWeb.OrderedUrls, plagiarismInWeb.OrderedUrlToWordsIndexes);

            _webResults = plagiarismInWeb.OrderedWebResults;
            for (int i = 0; i < _webResults.Count; i++)
            {
                textBox2.Text += _webResults[i].Url;
                textBox2.Text += Environment.NewLine;

                textBox2.Text += String.Format("{0:P2} text found", _webResults[i].CharactersPercentage);
                textBox2.Text += Environment.NewLine;

                foreach (var commonTextPart in _webResults[i].CommonTextParts)
                {
                    textBox2.Text += commonTextPart;
                    textBox2.Text += Environment.NewLine;
                }

                textBox2.Text += Environment.NewLine;
            }
        }
Пример #2
0
        private async Task SearchForPlagiarismLocally(string fileName)
        {
            richTextBox1.Text = string.Empty;
            textBox2.Text     = string.Empty;

            var simplifiedText = TextDocumentManager.SimplifiedTextFromFile(fileName);

            var plagiarismInLocalDB = await PlagiarismInLocalDBFinder.Find(simplifiedText);

            richTextBox1.Text += simplifiedText + Environment.NewLine;
            richTextBox1.Text += $"Words count: {plagiarismInLocalDB.WordCount}" + Environment.NewLine;

            textBox2.Text += "Водность текста: " + plagiarismInLocalDB.Vodnost + " % " + Environment.NewLine;
            textBox2.Text += "Тошнотность текста: " + plagiarismInLocalDB.Toshnotnost + " % " + Environment.NewLine;

            foreach (var kvp in plagiarismInLocalDB.PlagiarismResult)
            {
                textBox2.Text += "DocumentID: " + kvp.Key + "\tWord Indexes: ";
                foreach (var item in kvp.Value)
                {
                    textBox2.Text += item + ", ";
                }
                textBox2.Text += Environment.NewLine;
            }
        }
Пример #3
0
        private void CompareTextButton_Click(object sender, EventArgs e)
        {
            Stopwatch s = new Stopwatch();

            s.Start();

            var oldText = TextDocumentManager.SimplifiedTextFromFile(oldTextFile);
            var newText = TextDocumentManager.SimplifiedTextFromFile(newTextFile);

            s.Stop();
            textBox2.Text += $"\tReading: {s.Elapsed}" + Environment.NewLine;
            s.Restart();

            var diffResuls = TextComparer.CompareByWords(oldText, newText);

            //CompareLines(oldText, newText);

            richTextBox1.ShowDifferences(diffResuls);

            s.Stop();
            textBox2.Text += $"\tComparing: {s.Elapsed}" + Environment.NewLine;
        }