Exemplo n.º 1
0
        public void CreationTest()
        {
            var medicaments = new Medicaments(Program.MedicamentsFileName);

            Console.WriteLine(medicaments);
            File.WriteAllText("MedOutput2.txt", medicaments.ToString());
        }
Exemplo n.º 2
0
        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())));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
 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));
 }