Example #1
0
 public BotOptions()
 {
     Name = "";
     ProfileOccurances = new List <ProfileOccurrance>();
     ProfileAlgorithms = new ProfileAlgorithmSelector();
     WordAlgorithms    = new AlgorithmSelector();
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }