public AnswerQuality(QuestionList questionList) { this.questionList = questionList; userQuality = new UserQuality(questionList); foreach (var answer in questionList.GetAllAnswers().Where(answer => !answers.ContainsKey(answer.Id))) { answers.Add(answer.Id, answer); } }
public static void ModifyTyposCorpus(QuestionList ql) { var detector = new SpellChecker(TrigramIndex.CreateFrom(ql)); Console.WriteLine("I am Modifying"); var start = DateTime.Now; foreach (var question in ql.GetAllQuestions()) { question.Text = String.Join(" ", question.Text.SplitInWordsAndStripHTML().Select(detector.Fix)); question.Title = String.Join(" ", question.Title.SplitInWordsAndStripHTML().Select(detector.Fix)); } Console.WriteLine("Questions modified in {0}", (DateTime.Now - start).TotalSeconds); start = DateTime.Now; foreach (var answer in ql.GetAllAnswers()) { answer.Text = String.Join(" ", answer.Text.SplitInWordsAndStripHTML().Select(detector.Fix)); } Console.WriteLine("Answers modified in {0}", (DateTime.Now - start).TotalSeconds); File.WriteAllLines(Program.QuestionsNoTyposFileName, ql.GetAllQuestions().Select(Question.FormatStringWrite)); File.WriteAllLines(Program.AnswersNoTyposFileName, ql.GetAllAnswers().Select(Answer.FormatStringWrite)); }
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); }
public void TestId() { var ql = new QuestionList(QuestionsFileName, AnswersFileName); var hasIdenticId = false; foreach (var question in ql.GetAllQuestions()) { foreach (var answer in ql.GetAllAnswers()) { hasIdenticId = true; if (answer.Id == question.Id) Console.WriteLine("BAD ID!!!!!!!!! " + answer.Id); } //Console.WriteLine(question.Id); } Assert.AreEqual(true, hasIdenticId); }
private static IEnumerable<string> GetAllVertices(QuestionList ql) { return ql.GetAllQuestions().Select(q => q.AuthorEmail).Concat(ql.GetAllAnswers().Select(q => q.AuthorEmail)).Distinct(); }