public Tree() { dataset = new List <Document>(); FileImporter FI = new FileImporter(); List <string> rawText = FI.importFile(); foreach (var line in rawText) { dataset.Add(new Document(line)); } List <Document.keys> keyList = new List <Document.keys>(); foreach (Document.keys val in (Document.keys[])Enum.GetValues(typeof(Document.keys))) { keyList.Add(val); } root = new Node(dataset, keyList); }
static void Main(string[] args) { Console.WriteLine("Loading..."); Console.WriteLine("----------------------------------------"); Tree tree = new Tree(); FileImporter FI = new FileImporter(); List <string> allLines = FI.importFile(); List <Document> testData = new List <Document>(); foreach (var line in allLines) { testData.Add(new Document(line)); } int TP = 0, FP = 0, FN = 0, TN = 0; foreach (var data in testData) { bool outcome = tree.climbTree(tree.root, data); if (data.spam && outcome) { TP++; } else if (data.spam && !outcome) { Console.WriteLine(data.msg); FN++; } else if (!data.spam && outcome) { FP++; } else if (!data.spam && !outcome) { TN++; } } Console.WriteLine("TP: " + TP + " FP: " + FP); Console.WriteLine("FN: " + FN + " TN: " + TN); Console.ReadLine(); }