Ejemplo n.º 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());
        }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 3
0
        }   //END OF UserInterface CONSTRUCTOR

        /// <summary>
        /// Method used to Analyze the text
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void uxAnalyze_Click(object sender, EventArgs e)
        {
            try
            {
                Dictionary<string, WordCount> dictonary = new Dictionary<string, WordCount>();
                int file1Words = TextAnalyzer.ProcessFile(uxText1.Text, 0, dictonary);
                int file2Words = TextAnalyzer.ProcessFile(uxText2.Text, 1, dictonary);
                int[] size = { file1Words, file2Words };
                MinPriorityQueue<float, WordFrequency> wordFrequencies = TextAnalyzer.GetMostCommonWord(dictonary, size, (int)uxNumberOfWords.Value);
                float answer = TextAnalyzer.GetDifference(wordFrequencies);
                MessageBox.Show("Difference Measure: " + answer.ToString());
            }   //END OF TRY BLOCK
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }   //END OF CATCH BLOCK
        }   //END OF uxAnalyze_Click METHOD
 /// <summary>
 /// Event handler for the uxAnalyze button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void uxAnalyze_Click(object sender, EventArgs e)
 {
     try
     {
         Dictionary <string, WordCount> lookup = new Dictionary <string, WordCount>();
         int   x    = TextAnalyzer.ProcessFile(uxText1.Text, 0, lookup);
         int   y    = TextAnalyzer.ProcessFile(uxText2.Text, 1, lookup);
         int[] size = { x, y };
         MinPriorityQueue <float, WordFrequency> queue = TextAnalyzer.GetMostCommonWord(lookup, size, (int)uxNumberOfWords.Value);
         float result = TextAnalyzer.GetDifference(queue);
         MessageBox.Show(result.ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }