Esempio n. 1
0
        public UserTopicsWalking(QuestionList questionList, ICollection<string> categories, TopicsStatistics topicStatistics)
        {
            this.topicStatistics = topicStatistics;

            UserQuestions = questionList.GetAllQuestions().Where(q => categories.Contains(q.Category))
                .GroupBy(q => q.AuthorEmail, (userEmail, hisQuestions) => new { userEmail, hisQuestions })
                .Where(u => u.hisQuestions.Count() >= 2)
                .ToDictionary(u => u.userEmail, u => u.hisQuestions);
            foreach (var questions in UserQuestions.Values)
            {
                foreach (var question in questions)
                {
                    var topic = topicStatistics.GetTopicByQuestionId(question.Id, Threshold);
                    if (topic == null) continue;

                    if (topicDistribution.ContainsKey(topic.Item1))
                    {
                        topicDistribution[topic.Item1]++;
                    }
                    else
                    {
                        topicDistribution[topic.Item1] = 1;
                    }
                }
            }
            userQuestionsCount = topicDistribution.Sum(it => it.Value);
            topicMoves = GetTopicSequenceFrequences(2);
        }
Esempio n. 2
0
        public void SetUp()
        {
            categories = new HashSet<string>
                         	{
                         		"illness",
                         		"treatment",
                         		"kidhealth",
                         		"doctor"
                         	};
            topicExclusions = new[]
                            {
                                1, 6, 7, 11, 13, 15, 16, 17, 21, 24, 34, 36, 38, 41, 47, 49, 50, 51, 57, 60, 61, 64, 65, 76,
                                77, 78, 83, 87, 89
                            };

            topicStatistics = new TopicsStatistics(Program.DefaultNotStemmedQuestionList);
            userTopicsWalking = new UserTopicsWalking(Program.DefaultNotStemmedQuestionList, categories, topicStatistics);
        }
Esempio n. 3
0
        public void DistributionInit()
        {
            topicsStatistics = new TopicsStatistics(Program.DefaultQuestionList);

            Console.WriteLine("Preparations have been done");
        }
Esempio n. 4
0
 public QuestionList NewQuestionListFilteredByTopics(params int[] topics)
 {
     var ts = new TopicsStatistics(this, Program.DocIdsFileName);
     var qst = topics.SelectMany(topic => ts.GetQuestionsByTopic(topic)).Distinct();
     return new QuestionList(qst);
 }
Esempio n. 5
0
        public UserStatistics(QuestionList questionList)
            : base(questionList)
        {
            var parser = new MailUserPageParser(Program.MailUsersDirectory);

            var questionUsers = questionList.GetAllQuestions().Select(q => q.AuthorEmail);
            var answerUsers = questionList.GetAllAnswers().Select(a => a.AuthorEmail);
            var questionListUsers = new HashSet<string>(questionUsers.Union(answerUsers));

            users = parser.GetObjects().Where(u => questionListUsers.Contains(u.Email)).ToList();

            TopicStatistics = new TopicsStatistics(questionList);
        }