Exemple #1
0
        private static void Work(List <string> a, NeuralNetwork network, ref double max, ref string answer, string str)
        {
            var b      = ProcessingString.ParseString(str);
            var matrix = ProcessingString.StringEquals(a, b);
            var weight = network.Run(matrix);

            if (weight.First() > max)
            {
                max    = weight.First();
                answer = str;
            }
        }
Exemple #2
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            var txt = ((TextBox)sender).Text;

            if (hiWords.Contains(txt))
            {
                CreateMEM();
            }
            else
            {
                Mem.ForEach(x => x.Dispose());
            }
            var a   = ProcessingString.ParseString(txt);
            var all = graff.GetEnd();
            //var all = new HashSet<string>();
            //for(int i = 0; i < 150; i++)
            //{
            //    all.Add("п");
            //}

            var network = new NeuralNetwork(3, new int[] { 2, 3, 1 });

            network.Load("load.txt");

            var max    = 0.0;
            var answer = "";//ответ, его надо вывести на экран

            for (int i = 0; i < all.Count; i++)
            {
                Work(a, network, ref max, ref answer, all[i]);
            }
            //graff.NextStep(answer);
            if (label == null)
            {
                label        = new Label();
                label.Text   = Graff.info[answer].First();
                label.Bounds = new Rectangle(50, 300, 1000, 100);
                Controls.Add(label);
            }
            else
            {
                label.Text = Graff.info[answer].First();
            }
            ///label1.Text = answer;
        }