Пример #1
0
    public void UploadTestResults(RAKETest test)
    {
        try
        {
            con = new SqlConnection(connectionString);
            string cmdStr = "insert into RakeTestResults values(" + test.id + ",' " + test.articleTitle + "', " + test.minCharLength +
                            ", " + test.maxWordsLength + ", " + test.minWordsFreq + ")";
            cmd = new SqlCommand(cmdStr, con);
            cmd.Connection.Open();
            cmd.ExecuteNonQuery();
            cmdStr = "";
            foreach (var keyword in test.testResults)
            {
                //cmdStr=
                cmd.CommandText = "insert into KeywordsInTest values(" + test.id + ",'" + keyword.Key + "','" + keyword.Value + "')";
                cmd.ExecuteNonQuery();
            }

            cmd.Connection.Close();
        }
        catch (Exception ex)
        {
            var t = ex;
        }
        finally { cmd.Connection.Close(); }
    }
Пример #2
0
    protected void BigRakeTestAttempt()
    {
        string   stopListPath   = MapPath(".") + "/Files/SmartStoplist.txt";
        int      minCharLength  = 1;
        int      maxWordsLength = 1;
        int      minWordsFreq   = 1;
        string   articleTitle   = articleDDL.Items[articleDDL.SelectedIndex].ToString();
        string   text           = File.ReadAllText(articleDDL.SelectedValue);
        Rake     rake;
        RAKETest rt = new RAKETest();



        int id = 1;
        List <Dictionary <string, double> > allResults = new List <Dictionary <string, double> >();

        for (int i = 1; i < 4; i++)
        {
            for (int j = 1; j < 5; j++)
            {
                for (int k = 1; k < 6; k++)
                {
                    maxWordsLength = i;
                    minCharLength  = j;
                    minWordsFreq   = k;
                    rake           = new Rake(stopListPath, minCharLength, maxWordsLength, minWordsFreq);
                    var results = rake.Run(text);
                    var temp    = GetTopResults2(results, 30);
                    allResults.Add(temp);


                    rt.AddTest(new RAKETest(temp, (id), minCharLength, maxWordsLength, minWordsFreq, articleTitle));

                    id++;
                }
            }
        }

        //Console.WriteLine(allResults);
    }
Пример #3
0
 public void AddTest(RAKETest test)
 {
     new DBServices().UploadTestResults(test);
 }