/// <summary> /// 加载词列表 /// </summary> public void InitWordDics() { DateTime start = DateTime.Now; if (GetCache("jcms_dict") == null) { this.htWords = new Hashtable(); Hashtable father = this.htWords; Hashtable forfather = this.htWords; string strChar1; string strChar2; StreamReader reader = new StreamReader(this.DicPath, System.Text.Encoding.UTF8); string strline = reader.ReadLine(); SegList list; Hashtable child = new Hashtable(); long i = 0; while (strline != null && strline.Trim() != "") { i++; strChar1 = strline.Substring(0, 1); strChar2 = strline.Substring(1, 1); if (!this.htWords.ContainsKey(strChar1)) { father = new Hashtable(); this.htWords.Add(strChar1, father); } else { father = (Hashtable)this.htWords[strChar1]; } if (!father.ContainsKey(strChar2)) { list = new SegList(); if (strline.Length > 2) { list.Add(strline.Substring(2)); } else { list.Add("null"); } father.Add(strChar2, list); } else { list = (SegList)father[strChar2]; if (strline.Length > 2) { list.Add(strline.Substring(2)); } else { list.Add("null"); } father[strChar2] = list; } this.htWords[strChar1] = father; strline = reader.ReadLine(); } try { reader.Close(); } catch { } SetCache("jcms_dict", this.htWords); } this.htWords = (Hashtable)GetCache("jcms_dict"); this.alNoise = this.LoadWords(this.NoisePath, this.alNoise); this.alNumber = this.LoadWords(this.NumberPath, this.alNumber); this.alWord = this.LoadWords(this.WordPath, this.alWord); this.alPrefix = this.LoadWords(this.PrefixPath, this.alPrefix); TimeSpan duration = DateTime.Now - start; this.m_EventTime = duration.TotalMilliseconds; }