public GUI(string thesaurusExpanderPath) { _thesaurusExpanderPath = thesaurusExpanderPath; _thesaurusExpander = new ThesaurusExpander(); // load or create thesaurusExpander ThesaurusExpander.Load(thesaurusExpanderPath, out _thesaurusExpander); }
public static void Load(string thesaurusExpanderPath, out ThesaurusExpander thesaurusExpander) { // whatever, always try to load cache wikipedia content thesaurusExpander = new ThesaurusExpander(); string termFriendsPath = TERM_FRIENDS_FILENAME; if(File.Exists(termFriendsPath)) thesaurusExpander._termFriends = new Dictionary<string, HashSet<string>>( ReadFriends(termFriendsPath)); // load seeds string seedPath = thesaurusExpanderPath + "/" + SEED_TERMS_FILENAME; if(File.Exists(seedPath)) foreach(string term in Utils.ReadTerms(seedPath)) thesaurusExpander.SeedTerms.Enqueue(term); // fill other components if available string antiPath = thesaurusExpanderPath + "/" + ANTI_TERMS_FILENAME; if(File.Exists(antiPath)) thesaurusExpander.AntiTerms = Utils.ReadTerms(antiPath); string candidatePath = thesaurusExpanderPath + "/" + CANDIDATE_TERMS_FILENAME; if(File.Exists(candidatePath)) thesaurusExpander.CandidateTerms = Utils.ReadTerms(candidatePath);; string termPath = thesaurusExpanderPath + "/" + TERMS_FILENAME; if(File.Exists(termPath)) thesaurusExpander.Terms = Utils.ReadTerms(termPath); string scoresPath = thesaurusExpanderPath + "/" + TERM_SCORES_FILENAME; if(File.Exists(scoresPath)) thesaurusExpander._termScores = ReadScores(scoresPath); string alreadySeenPath = thesaurusExpanderPath + "/" + ALREADY_SEEN_FILENAME; if(File.Exists(alreadySeenPath)) thesaurusExpander._alreadySeen = Utils.ReadTerms(alreadySeenPath); }