Exemplo n.º 1
0
        private void BtnSubmit_Clicked(object sender, EventArgs e)
        {
            BigramService bigramService = new BigramService();
            var           words         = bigramService.SplitWords(txtInput.Text);
            List <Bigram> bigrams       = bigramService.GetSequence(words);

            lblOutput.Text = bigramService.GetOutput(bigrams);
        }
Exemplo n.º 2
0
        private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            BackgroundWorker worker = sender as BackgroundWorker;

            BigramService bigramService = new BigramService(_settings);
            var           words         = bigramService.SplitWords(txtInput.Text);

            worker.ReportProgress(5);
            List <Bigram> bigrams = bigramService.GetSequence(words, worker);

            //string output = bigramService.GetOutput(bigrams);


            if (_settings.ShowBigramGraph == true)
            {
                setBigramChart(bigrams);
            }

            if (_settings.ShowLetterFrequency == true)
            {
                setLetterChart(bigramService.GetLetterFrequency());
                //var a = bigramService.GetLetterFrequency();
            }

            stopwatch.Stop();
            TimeSpan ts = stopwatch.Elapsed;

            txtOutput.Text = string.Format("Input length: {0} {3}Words length: {1} {3}Runtime: {4} {3}{2}", txtInput.Text.Length, words.Length, bigramService.GetOutput(bigrams), Environment.NewLine, ts.TotalSeconds);
        }