/// <summary>
        /// Does a french stemming
        /// </summary>
        private void btnFrenchStem_Click(object sender, EventArgs e)
        {
            this.txtOutput.Text    = "";
            this.txtFinalText.Text = "";
            string input = txtInput.Text;

            foreach (string term in input.Split(' '))
            {
                if (string.IsNullOrEmpty(term))
                {
                    continue;
                }

                FrenchStemmer stemmer     = new FrenchStemmer();
                string        stemmedTerm = stemmer.stemTerm(term);

                if (stemmedTerm != term)
                {
                    txtOutput.Text += term + @" -> " + stemmedTerm + Environment.NewLine;
                }

                //save the stemmed term to the stemmed counts
                if (_frenchStemmedCounts.ContainsKey(stemmedTerm))
                {
                    _frenchStemmedCounts[stemmedTerm]++;
                }
                else
                {
                    _frenchStemmedCounts.Add(stemmedTerm, 1);
                }

                txtFinalText.Text += stemmedTerm + " ";
            }
        }
        /// <summary>
        /// Detects the language by finding the  top french words, and top english
        /// PRECONDITION: french stem and english stem must have been run at least once
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDetectLanguage_Click(object sender, EventArgs e)
        {
            //get the most popular french words
            IEnumerable <string> topFrench = GetMostPopularWords(_frenchStemmedCounts);
            //get the most popular english words
            IEnumerable <string> topEnglish = GetMostPopularWords(_englishStemmedCounts);

            int frenchCounter  = 0;
            int englishCounter = 0;

            FrenchStemmer frenchStemmer  = new FrenchStemmer();
            PorterStemmer englishStemmer = new PorterStemmer();

            //find the top french in text
            string input = this.txtInput.Text;

            foreach (string term in input.Split(' '))
            {
                string frenchStem  = frenchStemmer.stemTerm(term);
                string englishStem = englishStemmer.stemTerm(term);

                if (string.IsNullOrEmpty(term))
                {
                    continue;
                }
                foreach (string frenchTerm in topFrench)
                {
                    // if (frenchTerm.IgnoringCaseEquals(term))
                    if (frenchTerm.IgnoringCaseEquals(frenchStem))
                    {
                        frenchCounter++;
                    }
                }

                foreach (string englishTerm in topEnglish)
                {
                    // if (englishTerm.IgnoringCaseEquals(term))
                    if (englishTerm.IgnoringCaseEquals(englishStem))
                    {
                        englishCounter++;
                    }
                }
            }

            if (frenchCounter > englishCounter)
            {
                MessageBox.Show("French");
            }
            else if (englishCounter > frenchCounter)
            {
                MessageBox.Show("English");
            }
            else
            {
                MessageBox.Show("Not sure, have you run a stem on each language to train it?");
            }
        }
        /// <summary>
        /// Detects the language by finding the  top french words, and top english 
        /// PRECONDITION: french stem and english stem must have been run at least once
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDetectLanguage_Click(object sender, EventArgs e)
        {
            //get the most popular french words
            IEnumerable<string> topFrench = GetMostPopularWords(_frenchStemmedCounts);
            //get the most popular english words
            IEnumerable<string> topEnglish = GetMostPopularWords(_englishStemmedCounts);

            int frenchCounter = 0;
            int englishCounter = 0;

            FrenchStemmer frenchStemmer = new FrenchStemmer();
            PorterStemmer englishStemmer = new PorterStemmer();

            //find the top french in text
            string input = this.txtInput.Text;
            foreach (string term in input.Split(' '))
            {
                string frenchStem = frenchStemmer.stemTerm(term);
                string englishStem = englishStemmer.stemTerm(term);

                if (string.IsNullOrEmpty(term))
                    continue;
                foreach (string frenchTerm in topFrench)
                {
                   // if (frenchTerm.IgnoringCaseEquals(term))
                    if (frenchTerm.IgnoringCaseEquals(frenchStem))
                        frenchCounter++;
                }

                foreach (string englishTerm in topEnglish)
                {
                   // if (englishTerm.IgnoringCaseEquals(term))
                    if (englishTerm.IgnoringCaseEquals(englishStem))
                        englishCounter++;
                }

            }

            if (frenchCounter > englishCounter)
                MessageBox.Show("French");
            else if (englishCounter > frenchCounter)
                MessageBox.Show("English");
            else
                MessageBox.Show("Not sure, have you run a stem on each language to train it?");
        }
        /// <summary>
        /// Does a french stemming
        /// </summary>
        private void btnFrenchStem_Click(object sender, EventArgs e)
        {
            this.txtOutput.Text = "";
            this.txtFinalText.Text = "";
            string input = txtInput.Text;
            foreach (string term in input.Split(' '))
            {
                if (string.IsNullOrEmpty(term))
                    continue;

                FrenchStemmer stemmer = new FrenchStemmer();
                string stemmedTerm = stemmer.stemTerm(term);

                if (stemmedTerm != term)
                    txtOutput.Text += term + @" -> " + stemmedTerm + Environment.NewLine;

                //save the stemmed term to the stemmed counts
                if (_frenchStemmedCounts.ContainsKey(stemmedTerm))
                {
                    _frenchStemmedCounts[stemmedTerm]++;
                } else
                {
                    _frenchStemmedCounts.Add(stemmedTerm, 1);
                }

                txtFinalText.Text += stemmedTerm + " ";
            }
        }