public void CreationTest() { var medicaments = new Medicaments(Program.MedicamentsFileName); Console.WriteLine(medicaments); File.WriteAllText("MedOutput2.txt", medicaments.ToString()); }
public void IndexTest() { var questionList = Program.TestDefaultQuestionList; var medicaments = new Medicaments(Program.MedicamentsFileName); var meds = medicaments.FindMedicamentsInTexts(questionList.GetAllAnswers().Select(a => Tuple.Create(a.QuestionId, a.Text))).ToList(); Console.WriteLine(String.Join("\n", meds.Select(s => s.ToString()))); }
public void IndexCreation2() { var questionList = Program.DefaultQuestionList; var medicaments = new Medicaments(Program.MedicamentsFileName); var meds = medicaments.FindMedicamentsInTexts(questionList.GetAllQuestions().Select(a => Tuple.Create(a.Id, a.WholeText))).ToList(); File.WriteAllLines("MedicamentsIndexQuestionsCount.txt", meds.OrderByDescending(q => q.Ids.Count).Select(s => s.Word + "\t" + s.Ids.Count)); }
public static IEnumerable<InvertedIndexUnit> GetFuzzyIndex() { return DataActualityChecker.Check( new Lazy<InvertedIndexUnit[]>(() => { var questionList = Program.DefaultQuestionList; var medicaments = new Medicaments(Program.MedicamentsFileName); var idAnswerText = questionList.GetAllAnswers().Select(a => Tuple.Create(a.QuestionId, a.Text)); var fuzzyIndex = new FuzzyIndex(idAnswerText, medicaments.GetMedicamentNames()); return fuzzyIndex.GetIndex().OrderByDescending(k => k.Ids.Count).ToArray(); }), InvertedIndexUnit.FormatStringWrite, InvertedIndexUnit.FormatStringParse, new FileDependencies( Program.FilesDirectory + "MedicamentsFuzzyIndex.txt", Program.MedicamentsFileName)); }
public static IEnumerable<InvertedIndexUnit> GetDefaultIndex() { return DataActualityChecker.Check( new Lazy<InvertedIndexUnit[]>(() => { var questionList = Program.DefaultQuestionList; var medicaments = new Medicaments(Program.MedicamentsFileName); return medicaments .FindMedicamentsInTexts(questionList .GetAllAnswers() .Select(a => Tuple.Create(a.QuestionId, a.Text)) ) .OrderByDescending(k => k.Ids.Count) .ToArray(); }), InvertedIndexUnit.FormatStringWrite, InvertedIndexUnit.FormatStringParse, new FileDependencies( Program.MedicamentsIndexFileName, Program.MedicamentsFileName)); }