void LoadWordManager() { wordsManager = new WordsManager(); wordsManager.LoadFromLocal(); WordsManagerLoaded = true; if (DataLoaded) { MessageBox.Show(String.Format("初始化完成,用时 {0:F3} s", GetTimeElapsed())); } }
static void Main(string[] args) { //LaunchSpider("http://www.nwpu.edu.cn"); DBReader reader = new DBReader(); reader.ReadDBIndex(); reader.ReadDBContent(); //CalculateArgument(reader); WordsManager wordsManager = new WordsManager(); wordsManager.LoadFromLocal(); Rank.LoadFromLocal(); Console.WriteLine("初始化完成"); while (true) { string text = Console.ReadLine(); if (text.ToLower() == "exit") { break; } List <string> words = Splitter.GetWords(text); List <int> results = GetRawSearchResult(wordsManager, words); List <int> wordidxs = wordsManager.GetWordsIndex(words); results = Rank.SortResult(wordsManager, results, wordidxs, 0.001); Console.WriteLine(String.Join("\n", reader.PageIdx2Description(results))); } }