static private void LoadDictionary() { _WordDictionary = new PanGu.Dict.WordDictionary(); string dir = Setting.PanGuSettings.Config.GetDictionaryPath(); _WordDictionary.Load(System.IO.Path.Combine(dir, "Dict.dct")); _ChsName = new PanGu.Dict.ChsName(); _ChsName.LoadChsName(Setting.PanGuSettings.Config.GetDictionaryPath()); _WordDictionary.ChineseName = _ChsName; _StopWord = new PanGu.Dict.StopWord(); _StopWord.LoadStopwordsDict(System.IO.Path.Combine(dir, "Stopword.txt")); _Synonym = new PanGu.Dict.Synonym(); if (Setting.PanGuSettings.Config.MatchOptions.SynonymOutput) { _Synonym.Load(dir); } _DictLoader = new PanGu.Dict.DictionaryLoader(Setting.PanGuSettings.Config.GetDictionaryPath()); }
private void openBinDictFile13ToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialogDict.RestoreDirectory = true; openFileDialogDict.FileName = "Dict.dct"; openFileDialogDict.Filter = "Dictionay file|*.dct"; if (openFileDialogDict.ShowDialog() == DialogResult.OK) { try { DateTime old = DateTime.Now; _WordDict = new WordDictionary(); _WordDict.Load(openFileDialogDict.FileName, out _Version); TimeSpan s = DateTime.Now - old; statusStrip.Items[0].Text = s.TotalMilliseconds.ToString() + "ms"; } catch (Exception e1) { MessageBox.Show(String.Format("Can not open dictionary, errmsg:{0}", e1.Message)); return; } panelMain.Enabled = true; m_DictFileName = openFileDialogDict.FileName; this.Text = "V" + _Version + " " + openFileDialogDict.FileName; ShowCount(); } }
static private void LoadDictionary() { _WordDictionary = new PanGu.Dict.WordDictionary(); string dir = Setting.PanGuSettings.Config.GetDictionaryPath(); _WordDictionary.Load(dir + "Dict.Dct"); _ChsName = new PanGu.Dict.ChsName(); _ChsName.LoadChsName(Setting.PanGuSettings.Config.GetDictionaryPath()); _WordDictionary.ChineseName = _ChsName; _StopWord = new PanGu.Dict.StopWord(); _StopWord.LoadStopwordsDict(dir + "Stopword.txt"); _Synonym = new PanGu.Dict.Synonym(); if (Setting.PanGuSettings.Config.MatchOptions.SynonymOutput) { _Synonym.Load(dir); } _Wildcard = new PanGu.Dict.Wildcard(Setting.PanGuSettings.Config.MatchOptions, Setting.PanGuSettings.Config.Parameters); if (Setting.PanGuSettings.Config.MatchOptions.WildcardOutput) { _Wildcard.Load(dir); } _DictLoader = new PanGu.Dict.DictionaryLoader(Setting.PanGuSettings.Config.GetDictionaryPath()); }
static private void LoadDictionary(string fileName) { String currentDir = ""; string sysdir = ""; if (!string.IsNullOrEmpty(fileName)) { System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(fileName); currentDir = info.Parent.Parent.FullName; currentDir += "/"; } else { currentDir = PanGu.Framework.Path.GetAssemblyPath(); } sysdir = Setting.PanGuSettings.Config.GetDictionaryPath(fileName); IOHelper.WriteLog("path1=" + currentDir); _WordDictionary = new PanGu.Dict.WordDictionary(); string dir = currentDir + sysdir + "/"; IOHelper.WriteLog("dir=" + dir + "Dict.dct"); _WordDictionary.Load(dir + "Dict.dct"); _ChsName = new PanGu.Dict.ChsName(); IOHelper.WriteLog("_ChsName1=" + _ChsName); _ChsName.LoadChsName(currentDir + sysdir + "/"); IOHelper.WriteLog("_ChsName2=" + _ChsName); _WordDictionary.ChineseName = _ChsName; IOHelper.WriteLog("_ChsName3=" + _ChsName); _StopWord = new PanGu.Dict.StopWord(); IOHelper.WriteLog("dir=" + dir + "Stopword.txt"); _StopWord.LoadStopwordsDict(dir + "Stopword.txt"); _Synonym = new PanGu.Dict.Synonym(); if (Setting.PanGuSettings.Config.MatchOptions.SynonymOutput) { _Synonym.Load(dir); } _DictLoader = new PanGu.Dict.DictionaryLoader(sysdir); }