private void button3_Click(object sender, EventArgs e)
        {
            var bbl = new BoardBoolean(ListDocuments);

            bbl.CreateBoardVobu();
            bbl.CreateBoardDictionary();

            var dt = new DataTable();

            dt.Columns.Add("Từ Khóa");
            dt.Columns.Add("Chỉ số tài liệu");
            dt.Columns.Add("Tần số");
            dt.Columns.Add("TF");
            dt.Columns.Add("IDF");
            dt.Columns.Add("TF * IDF");
            foreach (var tuple in bbl.GetDictionList())
            {
                dt.Rows.Add(tuple.Key, tuple.Value.Item1, tuple.Value.Item2, "", tuple.Value.Item3.ToString(CultureInfo.InvariantCulture));
                foreach (var variable in tuple.Value.Item4)
                {
                    dt.Rows.Add("", variable.Item1, variable.Item2, "", variable.Item3.ToString(CultureInfo.InvariantCulture), variable.Item4.ToString(CultureInfo.InvariantCulture));
                }
            }
            var dicAndPosting = new DicAndPosting(dt);

            dicAndPosting.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            var dt = new DataTable();

            dt.Columns.Add("Title");
            dt.Columns.Add("Content");
            var dr = openFileDialog1.ShowDialog();

            if (dr == DialogResult.OK)
            {
                foreach (var file in openFileDialog1.FileNames)
                {
                    string content;
                    using (var reader = new StreamReader(file, Encoding.UTF8))
                    {
                        content = reader.ReadToEnd();
                    }
                    switch (_sword)
                    {
                    case false:
                    {
                        var document = new document(file, content, Regex, 1);
                        ListDocuments.Add(document);
                        dt.Rows.Add(document.Title, document.Content);
                    }
                    break;

                    case true:
                    {
                        var document = new document(file, content, Stopword, Regex);
                        ListDocuments.Add(document);
                        dt.Rows.Add(document.Title, document.Content);
                    }
                    break;
                    }
                }
            }
            dt.AcceptChanges();
            dataGridView1.DataSource = dt;
            DTable = dt;
            bbl    = new BoardBoolean(ListDocuments);
            bbl.CreateBoardBoolean();
            bbl.CreateBoardVobu();
            bbl.CreateBoardDictionary();
        }
        //Gom từ khóa có cùng chỉ số tài liệu và thêm tần số
        private void btnIndexing_Click(object sender, EventArgs e)
        {
            var bbl = new BoardBoolean(ListDocuments);

            bbl.CreateBoardVobu();
            var lstBoard = bbl.Vobu;
            var dt       = new DataTable();

            dt.Columns.Add("Từ Khóa");
            dt.Columns.Add("Chỉ số tài liệu");
            dt.Columns.Add("Tần số");
            foreach (var doc in lstBoard)
            {
                dt.Rows.Add(doc.Item1, doc.Item2, doc.Item3);
            }
            var index = new Indexing(dt);

            index.Show();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            var bbl = new BoardBoolean(ListDocuments);

            bbl.CreateBoardVobu();
            var lstBoard = bbl.Vobu;

            foreach (var tuple in lstBoard)
            {
                Console.WriteLine(tuple.Item1 + "\t" + tuple.Item2 + "\t" + tuple.Item3);
            }

            Console.WriteLine("-------------------------------------------------------");

            bbl.CreateBoardDictionary();
            foreach (var tuple in bbl.GetDictionList())
            {
                Console.WriteLine(tuple.Key + "\t" + tuple.Value.Item1 + "\t" + tuple.Value.Item2);
                foreach (var variable in tuple.Value.Item4)
                {
                    Console.WriteLine("\t" + variable.Item1 + "\t" + variable.Item2);
                }
            }
        }
예제 #5
0
 public SearchQuery(Query query, BoardBoolean boolean)
 {
     Query    = query;
     _boolean = boolean;
 }