Ejemplo n.º 1
0
        ///////////////////////////////////////////buttons part 2
        private void choose_btn_Click(object sender, EventArgs e)
        {
            Ranker.cleanList();

            openFileDialog1.FileName = "";
            openFileDialog1.ShowDialog();
            List <string> qry = new List <string>();

            if (openFileDialog1.FileName != "")
            {
                try
                {
                    qry = Files.qureys(openFileDialog1.FileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("wrong file");
                }
            }
            List <string> qid = new List <string>();
            List <string> q   = new List <string>();

            for (int i = 0; i < qry.Count; i = i + 2)
            {
                qid.Add(qry[i]);
                q.Add(qry[i + 1]);
            }
            Searcher.parseQuerys(qid, q, 50);
        }
Ejemplo n.º 2
0
 private void save_qry_Click(object sender, EventArgs e)
 {
     browser.ShowDialog();
     try
     {
         Ranker.writeList(@"C:\Users\aviv9_000\Desktop\all");
     }
     catch (Exception) {}
     Ranker.cleanList();
 }
Ejemplo n.º 3
0
        private void reset_btn_Click(object sender, EventArgs e)
        {
            //if index doesnt exixt -> alert

            Ranker.cleanList();
            qry_txt.Text             = "";
            openFileDialog1.FileName = "";
            Doc_Search_chk.Checked   = false;
            expantion_chk.Checked    = false;
        }
Ejemplo n.º 4
0
        private void run_query_btn_Click(object sender, EventArgs e)
        {
            Ranker.cleanList();
            //if index doesnt exixt -> alert

            if (qry_txt.Text == "")
            {
                return;
            }

            if (Doc_Search_chk.Checked)
            {
                if (Parse.DocDic.ContainsKey(qry_txt.Text))
                {
                    string s       = Parse.DocDic[qry_txt.Text].Split(',')[0]; //name of file
                    string s2      = browseCurpus.Text;                        //corpus location
                    string docpath = s2 + "/corpus/" + s + "/" + s;
                    //read the file , find the doc, parse 5 sentences from the doc;
                }
                return;
            }


            Parse         p    = new Parse();
            List <string> ans  = new List <string>();
            int           back = 50;

            if (expantion_chk.Checked && !qry_txt.Text.Contains(" "))
            {
                ans = Files.viki(qry_txt.Text);//need 50 docs instead of 70
            }
            if (ans.Count != 0)
            {
                back = 70;
            }

            Indexer.path = pathPost.Text;
            string final = qry_txt.Text;

            for (int i = 0; i < ans.Count; i++)
            {
                final += " " + ans[i];
            }
            ans.Clear();

            Random rnd = new Random();

            Searcher.parseQuery("" + rnd.Next(100000, 999999), final, back, true);
        }