public void addClass(string filename, string classname) { BayesClass cl = new BayesClass(classname); samplesCount += cl.parseFile(ref corrector, filename); classes.Add(cl); }
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); }