Exemple #1
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));
        }