Exemple #1
0
        public void addClass(string filename, string classname)
        {
            BayesClass cl = new BayesClass(classname);

            samplesCount += cl.parseFile(ref corrector, filename);
            classes.Add(cl);
        }
Exemple #2
0
        string classify(string[] tokens)
        {
            float      max = 0, p = 1;
            BayesClass cl = new BayesClass("");

            for (int ind = 0; ind != classes.Count; ind++)
            {
                p = classes[ind].classify(tokens) * classes[ind].probability;
                if (p > max)
                {
                    max = p;
                    cl  = classes[ind];
                }
            }
            return(cl.name);
        }