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; } }
public void serchbase() { cls.UpdateData("truncate table serchmetabase"); DataTable ds22 = new DataTable(); if (Session["serchtype"] == "2") { ds22 = cls.RetDataTable("select UP_ID,UP_FileName from uploadfileslist "); if (ds22.Rows.Count > 0) { for (int g = 0; g <= ds22.Rows.Count - 1; g++) { string aassw = txtserch.Text + ".txt"; DataRow drw = ds22.Rows[g]; id = Convert.ToInt32(drw[0]); if (drw[1].ToString() == aassw) { obj.ser_UP_ID = id; obj.ser_count = 1; obj.counter = 1; obj.baseserch(); } DataSet ds = new DataSet(); obj.ser_UP_ID = id; obj.words = txtserch.Text; ds = obj.metaserch(); if (ds.Tables[0].Rows.Count > 0) { DataRow drw2 = ds.Tables[0].Rows[0]; obj.ser_count = Convert.ToInt32(drw2[0]); obj.ser_UP_ID = id; obj.counter = 1; obj.baseserch(); } } } num0 = GenRand(0.9, 2.0); a = a + num0; a = Math.Round(a, 2); fillgrid(); } }
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; } }
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; } }
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; } }