Beispiel #1
0
        public Request(string baseName, List <string> choosen)
        {
            InitializeComponent();
            this.indegrades = FileAdapter.GetIngredients("data\\" + baseName + ".boi");
            Header.Content  = indegrades[index][0];
            indegrades[index].RemoveAt(0);
            OptionsComboBox.ItemsSource = indegrades[index];
            Descriptions.Text           = FileAdapter.GetDescripionToCategory(baseName, index);

            isFirst       = false;
            this.choosen  = choosen;
            this.baseName = baseName;
        }
Beispiel #2
0
        public AddRule(string baseName, List <string> listOfChoosen)
        {
            InitializeComponent();
            this.baseName      = baseName;
            this.listOfChoosen = listOfChoosen;
            try
            {
                ListOfIngredients = FileAdapter.GetIngredients("data\\" + baseName + ".boi");
                ListOfDiagnose    = FileAdapter.GetIngredients("data\\" + baseName + ".bod");
            }
            catch
            {
                return;
            }

            SetCategoryInWindow();
        }
Beispiel #3
0
        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);
        }