Ejemplo n.º 1
0
 public Dictionary<Sequence, int> GetTopicSequenceFrequences(int sequenceLength)
 {
     var topicQuestionPairsSequences =
         GetTopicQuestionPairSequences(sequenceLength).Select(seq => seq.Select(pair => pair.Item1).ToList());
     var topicSequences = new Dictionary<Sequence, int>();
     foreach (var topicList in topicQuestionPairsSequences)
     {
         var seq = new Sequence(topicList.Count, topicList);
         if (!topicSequences.ContainsKey(seq))
         {
             topicSequences[seq] = 0;
         }
         topicSequences[seq]++;
     }
     return topicSequences;
 }
Ejemplo n.º 2
0
 private double GetGivenProbability(Sequence move)
 {
     if (!topicMoves.ContainsKey(move))
     {
         return 0;
     }
     return ((double)topicMoves[move]) * userQuestionsCount / (topicDistribution[move.Items[0]] * topicDistribution[move.Items[1]]);
 }
Ejemplo n.º 3
0
        public Dictionary<Sequence, List<List<Question>>> GetTopicMoveQuestions(int lowFrequencyBoundary)
        {
            var moveQuestions = new Dictionary<Sequence, List<List<Question>>>();
            if (topicMoves.Count == 0) return moveQuestions;
            var sequenceLength = topicMoves.First().Key.Items.Length;

            var topicQuestionPairSequences = GetTopicQuestionPairSequences(sequenceLength);
            foreach (var sequence in topicQuestionPairSequences)
            {
                var topicSequence = new Sequence(sequence.Count, sequence.Select(pair => pair.Item1).ToList());
                if (!moveQuestions.ContainsKey(topicSequence))
                    moveQuestions[topicSequence] = new List<List<Question>>();
                moveQuestions[topicSequence].Add(sequence.Select(pair => pair.Item2).ToList());
            }
            return moveQuestions.Where(kv => kv.Value.Count >= lowFrequencyBoundary).ToDictionary(kv => kv.Key, kv => kv.Value);
        }