Example #1
0
        private static void WriteConfig()
        {
            _network = new NodeNetwork <string>();
            _Stopwatch.Reset();

            foreach (string filePath in Directory.GetFiles($@"{AppContext.BaseDirectory}\Training\", "*.txt"))
            {
                Console.Write("Reading text from training file: ");
                _Stopwatch.Start();
                string rawInput = File.ReadAllText(filePath);
                Console.WriteLine($"{_Stopwatch.ElapsedMilliseconds}ms");
                _Stopwatch.Reset();

                Console.Write("Symbol to new-line replacement pass: "******"{_Stopwatch.ElapsedMilliseconds}ms");
                _Stopwatch.Reset();

                Console.Write("New-line split pass: "******"{_Stopwatch.ElapsedMilliseconds}ms");
                _Stopwatch.Reset();

                Console.WriteLine("Processing input list to create node network...");
                _Stopwatch.Start();
                _network.ProcessInput(splitByNewLines);
                Console.WriteLine($"Creation of node network completed: {_Stopwatch.ElapsedMilliseconds}ms");
                _Stopwatch.Reset();
            }

            Console.Write("Writing serialized network to file: ");
            _Stopwatch.Start();
            File.WriteAllText("config.json", JsonConvert.SerializeObject(_network));
            Console.WriteLine($"{_Stopwatch.ElapsedMilliseconds}ms");
            _Stopwatch.Reset();

            Console.WriteLine("All processes complete.");
        }