private void buttonFreq_Click(object sender, EventArgs e) { // check format if (!isOneWord() && !isTwoWords()) { MessageBox.Show("Неверный формат входной строки.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // get first form of source string string sourceString = sourceFirstForm(); // get frequency of words var freqLib = new TA.Statistic.Frequency(_words); int result = 0; if (isOneWord()) { result = freqLib.GetByOneWord(sourceString); } if (isTwoWords()) { result = freqLib.GetByBigramm(sourceString); } // print result Logger.LogText(string.Format("Поиск частоты [{0}]: {1} из {2}.", sourceString, result, _words.Count)); Logger.LogHtml(string.Format("<p><strong>Поиск частоты [{0}]:</strong> {1} из числа слов: {2}.</p>", sourceString, result, _words.Count)); }
public AnalysisStatisticForm(List <string> words, Connector.Redmine.Model.Issue task) { InitializeComponent(); Logger.TextChanged += (sender, e) => { resultTextBox.Text = e; }; resultTextBox.TextChanged += (sender, e) => { resultTextBox.SelectionStart = resultTextBox.TextLength; resultTextBox.ScrollToCaret(); }; _words = words; _task = task; Logger.LogHtml("<h1>Статистический анализ</h1>"); Logger.LogText("Статистический анализ"); // get frequency of words var freqLib = new TA.Statistic.Frequency(_words); var orderedWords = freqLib.Process().OrderByDescending(i => i.count); // log it Logger.LogHtml("<h2>Частота употребления слов</h2><ul>"); Logger.LogText("ЧАСТОТА УПОТРЕБЛЕНИЯ СЛОВ:"); foreach (var item in orderedWords) { Logger.LogHtml(string.Format("<li><strong>{0}</strong> — {1}</li>", item.word, item.count)); Logger.LogText(string.Format(" {0} — {1}", item.word, item.count)); } resultTextBox.Text += "\r\n"; Logger.LogHtml("</ul>"); }
public AnalysisStatisticForm(List<string> words, Connector.Redmine.Model.Issue task) { InitializeComponent(); Logger.TextChanged += (sender, e) => { resultTextBox.Text = e; }; resultTextBox.TextChanged += (sender, e) => { resultTextBox.SelectionStart = resultTextBox.TextLength; resultTextBox.ScrollToCaret(); }; _words = words; _task = task; Logger.LogHtml("<h1>Статистический анализ</h1>"); Logger.LogText("Статистический анализ"); // get frequency of words var freqLib = new TA.Statistic.Frequency(_words); var orderedWords = freqLib.Process().OrderByDescending(i => i.count); // log it Logger.LogHtml("<h2>Частота употребления слов</h2><ul>"); Logger.LogText("ЧАСТОТА УПОТРЕБЛЕНИЯ СЛОВ:"); foreach (var item in orderedWords) { Logger.LogHtml(string.Format("<li><strong>{0}</strong> — {1}</li>", item.word, item.count)); Logger.LogText(string.Format(" {0} — {1}", item.word, item.count)); } resultTextBox.Text += "\r\n"; Logger.LogHtml("</ul>"); }
private void buttonFreq_Click(object sender, EventArgs e) { // check format if (!isOneWord() && !isTwoWords()) { MessageBox.Show("Неверный формат входной строки.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // get first form of source string string sourceString = sourceFirstForm(); // get frequency of words var freqLib = new TA.Statistic.Frequency(_words); int result = 0; if (isOneWord()) result = freqLib.GetByOneWord(sourceString); if (isTwoWords()) result = freqLib.GetByBigramm(sourceString); // print result Logger.LogText(string.Format("Поиск частоты [{0}]: {1} из {2}.", sourceString, result, _words.Count)); Logger.LogHtml(string.Format("<p><strong>Поиск частоты [{0}]:</strong> {1} из числа слов: {2}.</p>", sourceString, result, _words.Count)); }