public BotOptions() { Name = ""; ProfileOccurances = new List <ProfileOccurrance>(); ProfileAlgorithms = new ProfileAlgorithmSelector(); WordAlgorithms = new AlgorithmSelector(); }
private Word PickWordByProbability(TwitterProfile profile) { var weights = profile.Words.Select(w => w.Occurrence).ToList(); var index = AlgorithmSelector.PickIndexWeighted(weights, _random); return(profile.Words[index].Word); }
private TwitterProfile PickProfileWeighted(IReadOnlyList <ProfileOccurrance> optionsProfileOccurances) { var weights = optionsProfileOccurances.Select(occ => occ.Occurrence).ToList(); var index = AlgorithmSelector.PickIndexWeighted(weights, _random); var profile = optionsProfileOccurances[index].Profile; return(profile); }
private Word PickWordByProbabilityWithPrediction(TwitterProfile profile, Word previousWord) { var word = profile.Words.SingleOrDefault(w => w.Word.Equals(previousWord)); if (word?.NextWordOccurrences == null || word.NextWordOccurrences.Count == 0) { return(PickWordByProbability(profile)); } var weights = word.NextWordOccurrences.Select(n => n.Occurrence).ToList(); var index = AlgorithmSelector.PickIndexWeighted(weights, _random); return(word.NextWordOccurrences[index].Word); }