Esempio n. 1
0
        public void Test_Calculate_Probability()
        {
            Corpus good = new Corpus();
            Corpus bad = new Corpus();

            good.Add("the chicken jumped over the moon", 3);
            bad.Add("the cow ran threw the moon", 3);

            Calculator c = new Calculator(Calculator.Defaults);
            Probability prob = c.CalculateProbabilities(good, bad);

            Assert.AreEqual<double>(0.3333333333333333, prob.Prob["the"]);
            Assert.AreEqual<double>(0.3333333333333333, prob.Prob["moon"]);
            //Assert.AreEqual<double>(Calculator.Defaults.LikelySpamScore, prob.Prob["ran"]);
            //Assert.AreEqual<double>(Calculator.Defaults.LikelySpamScore, prob.Prob["cow"]);
        }
Esempio n. 2
0
        public void Test_Matching()
        {
            Corpus good = new Corpus();
            Corpus bad = new Corpus();

            good.Add("the chicken jumped over the moon", 3);
            bad.Add("the cow ran threw the moon", 3);

            Calculator c = new Calculator(Calculator.Defaults);
            Probability prob = c.CalculateProbabilities(good, bad);

            Filter target = new Filter(prob);

            target.Test("the cow ran over the moon", 3);

            Assert.IsTrue(target.Test("the cow ran threw the moon", 3) > 0.98);
            Assert.IsTrue(target.Test("the cow ran over the moon", 3) > 0.25);
        }