コード例 #1
0
ファイル: Program.cs プロジェクト: renmengye/CoursePlanner
        public static void Main(string[] args)
        {
            string abbr = args.Length > 0 ? args[0] : "uoft_courses";
            InvertedWordIndex index = InvertedWordIndex.Read(abbr + ".idx");
            DefaultIIndexableCollection<Course> school = DefaultIIndexableCollection<Course>.ReadBin(abbr + ".bin");
            CourseSearchPresenter searchEngine = new CourseSearchPresenter(index, school);

            while (true)
            {
                Console.Write("Please input a query: ");
                string query = Console.ReadLine();
                CourseSearchResult result = searchEngine.GetItemList(query) as CourseSearchResult;
                Console.WriteLine(result.CodeNameMatches);
                //CourseSearchResult result = searchEngine.GetCourseList(query);

                //if (result.CodeNameMatches.Count > 0)
                //{
                //    Console.WriteLine("\nCourse:");
                //    Console.WriteLine(result.CodeNameMatches.First<Course>().ToString());
                //}
                //foreach (IIndexable item in result.RawMatches)
                //{
                //    Course course = item as Course;
                //    Console.WriteLine("{0}: {1}", course.Abbr, course.Name);
                //}
                //if (result.RawMatches.Count > 0) Console.WriteLine("\nRelevant:");
                //foreach (IIndexable item in result.RawMatches)
                //{
                //    Course course = item as Course;
                //    Console.WriteLine("{0}: {1}", course.Abbr, course.Name);
                //}
                //Console.WriteLine();
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: tash-had/CoursePlanner
        public static void Main(string[] args)
        {
            string            abbr  = args.Length > 0 ? args[0] : "uoft_courses";
            InvertedWordIndex index = InvertedWordIndex.Read(abbr + ".idx");
            DefaultIIndexableCollection <Course> school = DefaultIIndexableCollection <Course> .ReadBin(abbr + ".bin");

            CourseSearchPresenter searchEngine = new CourseSearchPresenter(index, school);

            while (true)
            {
                Console.Write("Please input a query: ");
                string             query  = Console.ReadLine();
                CourseSearchResult result = searchEngine.GetItemList(query) as CourseSearchResult;
                Console.WriteLine(result.CodeNameMatches);
                //CourseSearchResult result = searchEngine.GetCourseList(query);

                //if (result.CodeNameMatches.Count > 0)
                //{
                //    Console.WriteLine("\nCourse:");
                //    Console.WriteLine(result.CodeNameMatches.First<Course>().ToString());
                //}
                //foreach (IIndexable item in result.RawMatches)
                //{
                //    Course course = item as Course;
                //    Console.WriteLine("{0}: {1}", course.Abbr, course.Name);
                //}
                //if (result.RawMatches.Count > 0) Console.WriteLine("\nRelevant:");
                //foreach (IIndexable item in result.RawMatches)
                //{
                //    Course course = item as Course;
                //    Console.WriteLine("{0}: {1}", course.Abbr, course.Name);
                //}
                //Console.WriteLine();
            }
        }