private List <string> SortingRule(string baseName) { List <string> NotSortedList = FileAdapter.GetAllNotEditedRule(baseName); NotSortedList.Sort(CompareByLength); return(NotSortedList); }
public string Vote(string baseName) { List <List <string> > ind = FileAdapter.GetIngredients("data\\" + baseName + ".bod"); List <string> diagnose = ind[0]; int[] score = new int[diagnose.Count - 1]; int goodRule = 0; List <string> ListOfRules = FileAdapter.GetAllNotEditedRule(baseName); foreach (string rule in ListOfRules) { if (CheckRule(rule)) { goodRule++; string res = GetRuleResult(rule); try { score[diagnose.IndexOf(res)]++; } catch (Exception e) { MessageBox.Show(e.Message); } } } string message = "Błąd klasyfikacji"; if (goodRule == 0) { message = "nie znana reguła odpowiadająca podanym przesłankom"; } else { message = "Największą ilość głosów otrzymały diagnozy:\n"; string[] maxVoted = GetMaxVotedItems(score, diagnose); foreach (string item in maxVoted) { message += item + '\n'; } } return(message); }