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); }
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); }