/// <summary>
 /// 加载频道(分类)字典
 /// </summary>
 /// <param name="clear">是否清除词频信息</param>
 protected virtual void LoadJDictionary(bool clear)
 {
     foreach (string dictfile in _DictionaryCollection)
     {
         JDictionary jdict = (JDictionary)Dict.LoadFromBinFileEx(dictfile);
         foreach (T_DictStruct dictStruct in jdict.Dicts)
         {
             if (clear)
             {
                 dictStruct.Frequency = 0;
             }
             this._ExtractWords.InsertWordToDfa(dictStruct.Word, dictStruct);
             this._POS.AddWordPos(dictStruct.Word, dictStruct.Pos);
         } //foreach
     }     //foreach
 }
        public void AddDictFile(string newChannel, string parentChannel)
        {
            if (this.DictFiles.ContainsKey(newChannel))
            {
                Debug.Fail(newChannel + " is Exist!");
                return;
            }
            JDictionary jd = new JDictionary();
            string      newdir;
            string      newsubdir       = Utility.File.GetLimitDirectory(this.RootDir, this.FileCountForDir, out newdir);
            string      newFileName     = newsubdir + newChannel + "." + JDictionaryType.ToString();
            string      newFileFullName = Path.Combine(this.RootDir, newFileName);

            Directory.CreateDirectory(newdir);
            FileStream fs = File.Create(newFileFullName); fs.Close(); fs.Dispose();

            jd.FileInfo = new FileInfo(newFileFullName);

            XmlNode parentNode;

            if (string.IsNullOrEmpty(parentChannel))
            {
                parentNode = this.InnerDocument.DocumentElement;
            }
            else
            {
                parentNode = this.InnerDocument.DocumentElement.
                             SelectSingleNode(string.Format(".//dictfile[@channel='{0}']", parentChannel));
                if (parentNode == null)
                {
                    Debug.Fail(parentChannel + " isn't Exist!!!");
                    parentNode = this.InnerDocument.DocumentElement;
                }
            }

            XmlElement ele = this.InnerDocument.CreateElement("dictfile");

            ele.SetAttribute("channel", newChannel);
            ele.InnerText = newFileName;
            parentNode.AppendChild(ele);

            jd.Save();
            this.DictFiles.Add(newChannel, new FileInfo(newFileFullName));
        }