Example #1
0
        private void loadInitialSetting()
        {
            Corpus bad = new Corpus();
            Corpus good = new Corpus();
            bad.LoadFromFile("../../../Input_Data/Not_Watch.txt");
            good.LoadFromFile("../../../Input_Data/Watch.txt");

            _filter = new SpamFilter();
            _filter.Load(good, bad);
        }
Example #2
0
        private void loadInitialSetting()
        {
            Corpus bad = new Corpus();
            Corpus good = new Corpus();
            bad.LoadFromFile("../../../Input_Data/Not_Watch.txt");
            good.LoadFromFile("../../../Input_Data/Watch.txt");

            _filter = new SpamFilter();
            _filter.Load(good, bad);
        }
Example #3
0
        /// <summary>
        /// Initialize the SpamFilter based on a DataTable containing columns "IsSpam" and "Body".
        /// This is only useful to me the author, but hey, it's my code so I can do what I want!
        /// </summary>
        /// <param name="table"></param>
        public void Load(DataTable table)
        {
            _good = new Corpus();
            _bad  = new Corpus();

            foreach (DataRow row in table.Rows)
            {
                bool   isSpam = (bool)row["IsSpam"];
                string body   = row["Body"].ToString();
                if (isSpam)
                {
                    _bad.LoadFromReader(new StringReader(body));
                }
                else
                {
                    _good.LoadFromReader(new StringReader(body));
                }
            }

            CalculateProbabilities();
        }
Example #4
0
        /// <summary>
        /// Initialize the SpamFilter based on the supplied text
        /// </summary>
        /// <param name="goodReader"></param>
        /// <param name="badReader"></param>
        public void Load(TextReader goodReader, TextReader badReader)
        {
            _good = new Corpus(goodReader);
            _bad = new Corpus(badReader);

            CalculateProbabilities();
        }
Example #5
0
        /// <summary>
        /// Initialize the SpamFilter based on a DataTable containing columns "IsSpam" and "Body".
        /// This is only useful to me the author, but hey, it's my code so I can do what I want!
        /// </summary>
        /// <param name="table"></param>
        public void Load(DataTable table)
        {
            _good = new Corpus();
            _bad = new Corpus();

            foreach (DataRow row in table.Rows)
            {
                bool isSpam = (bool)row["IsSpam"];
                string body = row["Body"].ToString();
                if (isSpam)
                {
                    _bad.LoadFromReader(new StringReader(body));
                }
                else
                {
                    _good.LoadFromReader(new StringReader(body));
                }
            }

            CalculateProbabilities();
        }
Example #6
0
        /// <summary>
        /// Initialize the SpamFilter based on the contents of the supplied Corpuseses
        /// </summary>
        /// <param name="good"></param>
        /// <param name="bad"></param>
        public void Load(Corpus good, Corpus bad)
        {
            _good = good;
            _bad = bad;

            CalculateProbabilities();
        }