Exemplo n.º 1
0
        /// <summary>
        /// 载入已有词库
        /// </summary>
        public void LoadOldWords(string wordsFile)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(wordsFile);
            XmlNodeList nodes = doc.SelectNodes(@"//item");

            foreach (XmlNode node in nodes)
            {
                OldWords.Add(node.Attributes[0].Value, Convert.ToUInt64(node.Attributes[1].Value));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 合并词库中已有词汇
 /// </summary>
 public void MergeExistWords()
 {
     foreach (KeyValuePair <string, ulong> word in NewWords)
     {
         if (OldWords.ContainsKey(word.Key))
         {
             ExistWords.Add(word.Key, OldWords[word.Key] + word.Value);
         }
     }
     foreach (KeyValuePair <string, ulong> word in ExistWords)
     {
         if (NewWords.ContainsKey(word.Key))
         {
             NewWords.Remove(word.Key);
         }
     }
 }