コード例 #1
0
ファイル: Symptoms.cs プロジェクト: bellal89/cqa_medical
        public static void NounsSearch()
        {
            var voc = Program.DefaultVocabulary;
            var mainWords = voc.GetAllInfos().Where(s => s.PartOfSpeach == "V").Select(s=> s.Stem);
            var searcher = new Symptoms(voc, mainWords, "S");

            var questionList = Program.DefaultQuestionList;

            var symptoms = new Func<List<InvertedIndexUnit>>(()=> searcher
                .GetSymptomsIndex(questionList.GetAllQuestions().Select(item => Tuple.Create(item.Id, item.WholeText)))
                .ToList()).DetectTime("nouns found");
            File.WriteAllLines("nouns_verbs.txt", symptoms.Select(s => s.ToStringCount()));
        }
コード例 #2
0
ファイル: Symptoms.cs プロジェクト: bellal89/cqa_medical
        public static void TestSearch()
        {
            var voc = Program.DefaultVocabulary;
            var body = BodyPart.GetBodyPartsFromFile(Program.BodyPartsFileName);
            var searcher = new Symptoms(voc, body.GetWords(), "V");

            var questionList = Program.TestDefaultQuestionList;

            var start = DateTime.Now;
            var symptoms = searcher
                .GetSymptomsIndex(questionList.GetAllQuestions().Select(item => Tuple.Create(item.Id, item.WholeText)));
            Console.WriteLine("Symptoms found at {0} seconds.", (DateTime.Now - start).TotalSeconds);
            Console.WriteLine(String.Join("\n",symptoms.Select(s => s.ToString())));
        }
コード例 #3
0
ファイル: Symptoms.cs プロジェクト: bellal89/cqa_medical
        public void GetNounsForVerbs()
        {
            var ql = Program.DefaultQuestionList;

            var questionWords = ql.GetAllQuestions().Select(item => Tuple.Create(item.Id, item.WholeText));
            var answerswords = ql.GetAllAnswers().Select(item => Tuple.Create(item.Id, item.Text));
            var allWords = questionWords.Concat(answerswords);

            var nouns = GetWords(NounsFileName).ToArray();
            var verbs = GetWords(VerbsFileName).ToArray();

            var voc = Program.DefaultVocabulary;
            var searcher = new Symptoms(voc, verbs, "S");
            var nounVerbIndex = searcher.GetSymptomsIndex(allWords, new HashSet<string>(nouns));
            File.WriteAllLines("nounVerbIndex.txt", nounVerbIndex.Select(InvertedIndexUnit.FormatStringWrite));
            File.WriteAllLines("nounVerbIndexCount.txt", nounVerbIndex.OrderByDescending(a => a.Ids.Count).Select(a => a.ToStringCount()));
        }
コード例 #4
0
ファイル: Symptoms.cs プロジェクト: bellal89/cqa_medical
 public static IEnumerable<InvertedIndexUnit> GetDefaultIndex()
 {
     return DataActualityChecker.Check(
         new Lazy<InvertedIndexUnit[]>(
             () =>
                 {
                     var body = BodyPart.GetBodyPartsFromFile(Program.BodyPartsFileName);
                     var searcher = new Symptoms(Program.DefaultVocabulary, body.GetWords(), "V");
                     var questionList = Program.DefaultQuestionList;
                     return searcher.GetSymptomsIndex(questionList
                                                     .GetAllQuestions()
                                                     .Select(item => Tuple.Create(item.Id, item.WholeText)))
                         .OrderByDescending(k => k.Ids.Count)
                         .ToArray();
                 }),
         InvertedIndexUnit.FormatStringWrite,
         InvertedIndexUnit.FormatStringParse,
         new FileDependencies(
             Program.SymptomsIndexFileName,
             Program.QuestionsFileName));
 }