Example #1
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;
            }
        }
        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;
            }
        }
Example #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;
            }
        }
Example #4
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;
            }
        }