private void button13_Click(object sender, EventArgs e) { //tryget(); ListViewItem li; string[] arr = new string[2]; string col1 = ""; string col2 = ""; // treeView2.Nodes.Add("Topical Tweets"); // treeView3.Nodes.Add("Topical Tweets"); foreach (string data in c1) { col2 = ""; foreach (string str in collfin3) { //if (str.Contains("#")) //{ // //if (!str.Contains("#followfriday") && !str.Contains("#ff") && !str.Contains("#FF") && !str.Contains("#follow friday") && !str.Contains("was") && !str.Contains("had")) // //{ // // treeView2.Nodes[0].Nodes.Add(str); // // //string col1= // //} // //else // //{ // // if (!str.Contains("#followfriday") && !str.Contains("#ff") && !str.Contains("#FF") && !str.Contains("#follow friday")) // // treeView3.Nodes[0].Nodes.Add(str); // //} //} //else //{ List<string> gern = new List<string>() { }; if (str.Contains(data)) { //if (!str.Contains("was") && !str.Contains("had")) //{ // treeView2.Nodes[0].Nodes.Add(str); col1 = data; //col2 = ""; var coll_col2 = str.Split(' '); gern = coll_col2.ToList(); foreach (string chk in rem_topic) { gern.Remove(chk); } foreach (string spli_str in gern) { if (spli_str.Length > 5) { if (!col2.Contains(spli_str)) col2 += spli_str + ", "; } } // } //else //{ // treeView3.Nodes[0].Nodes.Add(str); //} } } if (col1 == textBox2.Text.Trim()) { Dictionary<List<int>, List<string>> r = new Dictionary<List<int>, List<string>>(); temp t = new temp(); r = t.reasonC(textBox2.Text); string strnew = temp.GetStr; // } Random ran = new Random(); int n = ran.Next(5, 10); var sp23 = strnew.Split(' '); string rabstr = ""; for (int k = 0; k < n; ) { Random ran1 = new Random(); int num = ran1.Next(1, sp23.Count()); if (!rabstr.Contains(sp23[num].ToString())) { rabstr += sp23[num].ToString() + ","; k++; } } if (col2 != "") { arr[0] = col1; arr[1] = col2+rabstr ; li = new ListViewItem(arr); listView3.Items.Add(li); break; } } //col2 = ""; } //treeView2.ExpandAll(); //treeView3.ExpandAll(); //button16_Click(null ,null ); }
private void button8_Click_1(object sender, EventArgs e) { List<string> final_lst = new List<string>(); ListViewItem li; string[] arr = new string[3]; string col1 = ""; string col2 = ""; // treeView2.Nodes.Add("Topical Tweets"); // treeView3.Nodes.Add("Topical Tweets"); foreach (string data in c1) { col2 = ""; foreach (string str in collfin3) { //if (str.Contains("#")) //{ // //if (!str.Contains("#followfriday") && !str.Contains("#ff") && !str.Contains("#FF") && !str.Contains("#follow friday") && !str.Contains("was") && !str.Contains("had")) // //{ // // treeView2.Nodes[0].Nodes.Add(str); // // //string col1= // //} // //else // //{ // // if (!str.Contains("#followfriday") && !str.Contains("#ff") && !str.Contains("#FF") && !str.Contains("#follow friday")) // // treeView3.Nodes[0].Nodes.Add(str); // //} //} //else //{ List<string> gern = new List<string>() { }; if (str.Contains(data)) { //if (!str.Contains("was") && !str.Contains("had")) //{ // treeView2.Nodes[0].Nodes.Add(str); col1 = data; //col2 = ""; var coll_col2 = str.Split(' '); gern = coll_col2.ToList(); foreach (string chk in rem_topic) { gern.Remove(chk); } foreach (string spli_str in gern) { if (spli_str.Length > 5) { if (!col2.Contains(spli_str)) { col2 += spli_str + ", "; } } } if(!final_lst .Contains (col2 )) final_lst.Add(col2); // } //else //{ // treeView3.Nodes[0].Nodes.Add(str); //} } } // } if (col2 != "") { //Random r = new Random(); //int num = r.Next(10, 50); //arr[0] = col1; //arr[1] = col2; //arr[2] = num.ToString(); //li = new ListViewItem(arr); //listView2.Items.Add(li); } //col2 = ""; } Random r1 = new Random(); int num1 = r1.Next(8, 15); List<int> re=new List<int> (); for (int j = 0; j < num1; ) { Random r = new Random(); int num = r.Next(j, 25); if (!re.Contains(num)) { re.Add(num); j = j + 1; } } //for(int i=0;i<num1;i++) //{ // //arr[0] = col1; // arr[0] = final_lst[i].ToString (); // arr[1] = re[i].ToString(); // li = new ListViewItem(arr); // listView2.Items.Add(li); //} temp t = new temp(); Dictionary<List<int>, List<string>> newdic = new Dictionary<List<int>, List<string>>(); newdic=t.reasonC(textBox2.Text.ToString ()); foreach (KeyValuePair<List<int>, List<string>> kvp in newdic.OrderBy(key => key.Key )) { for (int i = 0, j = 0; i < kvp.Key.Count && j < kvp.Value.Count ; i++, j++) { arr[1] = kvp.Key[i].ToString(); arr[0] = kvp.Value[j].ToString(); li = new ListViewItem(arr); listView2.Items.Add(li); } } //treeView2.ExpandAll(); //treeView3.ExpandAll(); //button16_Click1(null, null); }