示例#1
0
        private void LoadCallback(IrcMessageEventArgs message)
        {
            var brainFile = GetBrainFile(message);
            var loader    = new LoadBehaviour(_markovChainString, brainFile);

            loader.Process();

            var reply = message.CreateReply($"Loaded brain '{brainFile}'");

            Bot.SendMessage(reply);
        }
示例#2
0
文件: Trainer.cs 项目: kenwi/vokram
        public static MarkovChainString Load(Config parameters, Action <string> output)
        {
            output?.Invoke($"Loading '{parameters.Load}'");

            var markovChainString = new MarkovChainString();
            var loadBehaviour     = new LoadBehaviour(markovChainString, parameters.Load);
            var talkBehaviour     = new TalkBehaviour(markovChainString);

            output?.Invoke($"Generating samples");
            loadBehaviour.Process();
            Enumerable.Range(0, parameters.Samples).ForEach(i =>
            {
                var sample = talkBehaviour.GenerateRandomSentence();
                output?.Invoke($"{i}: '{sample}'");
            });
            return(markovChainString);
        }