/// <summary> /// This is a partially CPU-bound operation. /// </summary> public static void LoadDictionaries(bool force = false) { if (force == false && DataIsLoaded) { return; } var works = new WorkList(11); works.AddWork(() => SinoVietPronunciationDict = GetSinoVietPronunciationDictPath().LoadDictionary()); works.AddWork(() => ThieuChuuDict = GetThieuChuuDictPath().LoadDictionary()); works.AddWork(() => LacVietDict = GetLacVietDictPath().LoadDictionary()); works.AddWork(() => CedictBabylonDict = (GetCEDictDictPath(), GetBabylonDictPath()).LoadCedictAndBabylon()); works.AddWork(() => EnglishTransliterationDict = GetEnglishTransliterationDictPath().LoadDictionary()); works.AddWork(() => LoadIgnoredChinesePhraseLists()); works.AddWork(() => LoadLog(GetNameLogPath(), NameOnlyLogDataSet)); works.AddWork(() => LoadLog(GetSecondaryNameLogPath(), NamePhuOnlyLogDataSet)); works.AddWork(() => LoadLog(GetVietPhraseLogPath(), VietPhraseOnlyLogDataSet)); works.AddWork(() => LoadLog(GetSinoVietPronunciationLogPath(), SinoVietPronunciationLogDataSet)); works.AddWork(() => MultiplyRuleDict = GetMultiplyRuleDictPath().LoadDictionary(ignoreComment: true)); var works2 = new WorkList(3); works2.AddWork(() => PronounDict = GetPronounDictPath().LoadDictionary()); works2.AddWork(() => VietPhraseDict = GetVietPhraseDictPath().LoadDictionary()); works2.AddWork(() => LoadNameOnlyDict()); works2.ForEach(work => work.WaitOne()); ComposeVietPhraseAndNameDict(); VietPhraseDictionaryToVietPhraseOneMeaningDictionary(); PronounDictionaryToPronounOneMeaningDictionary(); LoadMultiplyByDict(); LoadMultiplyByOneMeaningDict(); works.ForEach(work => work.WaitOne()); DataIsLoaded = true; }