private void Top_10_NoStopsButton_Click_1(object sender, EventArgs e) { Top_10NoStops.Clear(); string raw_input = this.InputTextBox.Text; List <string> stopwords = new List <string>(); if (Stopwords.CheckedItems.Count == 0) { MessageBox.Show("No Stopwords selected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { for (int i = 0; i < Stopwords.Items.Count; i++) { if (Stopwords.GetItemChecked(i)) { stopwords.Add((string)Stopwords.Items[i]); } } var stopwords_docs = Program.GetDocs_NoStopwords(raw_input, stopwords); var stoplist_docs = Program.TF_IDF(stopwords_docs); var top10_noStops = stoplist_docs.SelectMany(x => x).OrderBy(x => x.Value).Select(x => x.Key).Distinct().Take(10).ToList(); for (int i = 0; i < top10_noStops.Count; i++) { Top_10NoStops.Items.Add(top10_noStops[i]); } } }
private void comboNoStops_SelectedIndexChanged(object sender, EventArgs e) { Stem_NoStops.Clear(); #pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast if (comboNoStops.SelectedItem == "Stemmed Text_Eng") #pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast { string raw_input = this.InputTextBox.Text; List <string> stopwords = new List <string>(); if (Stopwords.CheckedItems.Count == 0) { MessageBox.Show("No Stopwords selected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { for (int i = 0; i < Stopwords.Items.Count; i++) { if (Stopwords.GetItemChecked(i)) { stopwords.Add((string)Stopwords.Items[i]); } } var stopwords_docs = Program.GetDocs_NoStopwords(raw_input, stopwords); var stopStem_docs = Program.EnglishStemming(stopwords_docs); var stoplist_docStem = Program.TF_IDF(stopStem_docs); var top10_StemEngNoStops = stoplist_docStem.SelectMany(x => x).OrderBy(x => x.Value).Select(x => x.Key).Distinct().Take(10).ToList(); for (int i = 0; i < top10_StemEngNoStops.Count; i++) { Stem_NoStops.Items.Add(top10_StemEngNoStops[i]); } } } #pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast else if (comboNoStops.SelectedItem == "Stemmed Text_Pt") #pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast { string raw_input = this.InputTextBox.Text; List <string> stopwords = new List <string>(); if (Stopwords.CheckedItems.Count == 0) { MessageBox.Show("No Stopwords selected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { for (int i = 0; i < Stopwords.Items.Count; i++) { if (Stopwords.GetItemChecked(i)) { stopwords.Add((string)Stopwords.Items[i]); } } var stopwords_docs = Program.GetDocs_NoStopwords(raw_input, stopwords); var stopStem_docs = Program.PortugueseStemming(stopwords_docs); var stoplist_docStem = Program.TF_IDF(stopStem_docs); var top10_StemPtNoStops = stoplist_docStem.SelectMany(x => x).OrderBy(x => x.Value).Select(x => x.Key).Distinct().Take(10).ToList(); for (int i = 0; i < top10_StemPtNoStops.Count; i++) { Stem_NoStops.Items.Add(top10_StemPtNoStops[i]); } } } }