Example #1
0
        /// <summary>
        /// Used to analyze the two texts and make a message box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void uxAnalyze_Click(object sender, EventArgs e)
        {
            Dictionary <string, WordCount> dictionary = new Dictionary <string, WordCount>();

            int[] wordCount = new int[2];
            wordCount[0] = TextAnalyzer.ProcessFile(uxText1.Text, 0, dictionary);
            wordCount[1] = TextAnalyzer.ProcessFile(uxText2.Text, 1, dictionary);
            MinPriorityQueue <float, WordFrequency> minQueue = TextAnalyzer.GetMostCommonWords(dictionary, wordCount, (int)uxNumberOfWords.Value);
            float diff = TextAnalyzer.GetDifference(minQueue);

            MessageBox.Show("Difference measure: " + diff.ToString());
        }
Example #2
0
 /// <summary>
 /// processes both files, gets the words having the highest combined frequencies,
 /// then computes and displays the difference measure
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void uxAnalyze_Click(object sender, EventArgs e)
 {
     try
     {
         int[] words = new int[2];
         Dictionary <string, WordCount> dictionary = new Dictionary <string, WordCount>();
         words[0] = TextAnalyzer.ProcessFile(uxText1.Text, 0, dictionary);
         words[1] = TextAnalyzer.ProcessFile(uxText2.Text, 1, dictionary);
         MinPriorityQueue <float, WordFrequency> queue = TextAnalyzer.GetMostCommonWords(dictionary, words, (int)uxNumberOfWords.Value);
         MessageBox.Show("Difference Measure: " + TextAnalyzer.GetDifference(queue).ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }