Exemplo n.º 1
0
        protected void btnserch_Click(object sender, EventArgs e)
        {
            if (Session["serchtype"] == "2")
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                serchbase();
                stopwatch.Stop();
                TimeSpan ts = stopwatch.Elapsed;

                // Format and display the TimeSpan value.
                string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                                   ts.Hours, ts.Minutes, ts.Seconds,
                                                   ts.Milliseconds / 10);
                int h = Convert.ToInt32(cls.RetVal("select COUNT (tim_type ) from querytime where tim_type=1 group by tim_type"));
                h = h + 1;
                cls.UpdateData("insert into querytime values('query" + h + "','" + a + "', 1)");
            }
            else
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                serchadvn();
                stopwatch.Stop();
                TimeSpan ts = stopwatch.Elapsed;

                // Format and display the TimeSpan value.
                string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                                   ts.Hours, ts.Minutes, ts.Seconds,
                                                   ts.Milliseconds / 10);
                int h = Convert.ToInt32(cls.RetVal("select COUNT (tim_type ) from querytime where tim_type=2 group by tim_type"));
                h = h + 1;
                cls.UpdateData("insert into querytime values('query" + h + "','" + a + "', 2)");
            }
        }
Exemplo n.º 2
0
        public void matadata()
        {
            try
            {
                pid = Convert.ToInt32(cls.RetVal("select Top 1 up_id from uploadfileslist  order by up_id desc"));
                string filename    = (Server.MapPath("~/all/base/") + txtfilename.Text);
                string inputString = File.ReadAllText(filename);
                inputString = inputString.ToLower();

                string[] stripChars = { ";", ",", ".", "-", "_", "^", "(", ")", "[", "]", "'",
                                        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\n","\t", "\r" };
                foreach (string character in stripChars)
                {
                    inputString = inputString.Replace(character, "");
                }
                List <string>            wordList   = inputString.Split(' ').ToList();
                Dictionary <string, int> dictionary = new Dictionary <string, int>();
                foreach (string word in wordList)
                {
                    if (word.Length >= 3)
                    {
                        if (dictionary.ContainsKey(word))
                        {
                            dictionary[word]++;
                        }
                        else
                        {
                            dictionary[word] = 1;
                        }
                    }
                }
                var    sortedDict = (from entry in dictionary orderby entry.Value descending select entry).ToDictionary(pair => pair.Key, pair => pair.Value);
                cumfun obj        = new cumfun();
                foreach (KeyValuePair <string, int> pair in sortedDict)
                {
                    if (pair.Value <= 2)
                    {
                    }
                    else
                    {
                        obj.UpdateData("insert into matadatabase values('" + pair.Key + "','" + pair.Value + "','" + pid + "')");
                    }
                }
                clearall();
                Label1.Visible   = true;
                Label1.Text      = "File Uploaded Successfully.";
                Label1.ForeColor = System.Drawing.Color.Green;
            }
            catch
            {
                Label1.Visible   = true;
                Label1.Text      = "Error Please try again.";
                Label1.ForeColor = System.Drawing.Color.Red;
            }
        }
Exemplo n.º 3
0
        public void matadata()
        {
            try
            {
                pid = Convert.ToInt32(cls.RetVal("select Top 1 up_id from advncuploadfileslist  order by up_id desc"));
                string filename    = (Server.MapPath("~/all/advance/") + txtfilename.Text);
                string inputString = File.ReadAllText(filename);
                inputString = inputString.ToLower();
                string[] doc = new string[1]
                {
                    inputString.ToString()
                };
                //ServiceRanking.TFIDFMeasure tf = new ServiceRanking.TFIDFMeasure(doc);

                string[] stripChars = { ";", ",", ".", "-", "_", "^", "(", ")", "[", "]", "'",
                                        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\n","\t", "\r" };

                foreach (string character in stripChars)
                {
                    inputString = inputString.Replace(character, "");
                }

                List <string> wordList = inputString.Split(' ').ToList();

                stpwordshndl stopwords = new stpwordshndl();
                string[]     stopword  = stopwords.StopWordsHandler();

                foreach (string word in stopword)
                {
                    while (wordList.Contains(word))
                    {
                        wordList.Remove(word);
                    }
                }

                foreach (string word in wordList)
                {
                    Stemming.PorterStemmer pf = new Stemming.PorterStemmer();
                    string ssh = pf.stemTerm(word);
                    skk = ssh + " " + skk;
                }
                List <string> wordList2 = skk.Split(' ').ToList();

                Dictionary <string, int> dictionary = new Dictionary <string, int>();
                foreach (string word in wordList2)
                {
                    if (word.Length > 3)
                    {
                        if (dictionary.ContainsKey(word))
                        {
                            dictionary[word]++;
                        }
                        else
                        {
                            dictionary[word] = 1;
                        }
                    }
                }
                var    sortedDict = (from entry in dictionary orderby entry.Value descending select entry).ToDictionary(pair => pair.Key, pair => pair.Value);
                cumfun obj        = new cumfun();
                foreach (KeyValuePair <string, int> pair in sortedDict)
                {
                    if (pair.Value <= 2)
                    {
                    }
                    else
                    {
                        obj.UpdateData("insert into matadataadvnce values('" + pair.Key + "','" + pair.Value + "','" + pid + "')");
                    }
                }
                clearall();
                Label1.Visible   = true;
                Label1.Text      = "File Uploaded Successfully.";
                Label1.ForeColor = System.Drawing.Color.Green;
            }
            catch
            {
                Label1.Visible   = true;
                Label1.Text      = "Error Please try again.";
                Label1.ForeColor = System.Drawing.Color.Red;
            }
        }