loaddict.cs

来自「广义Jaccard系数(Tanimoto系数):是对Jaccard系数的扩展」· CS 代码 · 共 61 行

CS
61
字号
namespace ClusterUsingKmeans
{
    using System;
    using System.Collections;
    using System.IO;
    using System.Text;
    using System.Collections.Generic;

    public class LoadDict
    {
        private Dictionary<string,string> _sogou = new Dictionary<string,string>() ;
        private Dictionary<string,string>  _sogou1 = new Dictionary<string,string> ();
        private static bool instance_flag = false;
///加载词库
        private LoadDict()
        {
            StreamReader reader = new StreamReader("SogouLabDic.dic", Encoding.Default);
            string text = null;
            while ((text = reader.ReadLine()) != null)
            {
                char[] separator = new char[] { '\t' };
                string[] textArray = text.Split(separator);
                this.sogou.Add(textArray[0], textArray[1]);
                this.sogou1.Add(textArray[0], textArray[2]);
            }
        }
        public static LoadDict getDict()
        {
            if (!instance_flag)
                return new LoadDict();
            else
                return null;
        }

        public Dictionary<string, string> sogou
        {
            get
            {
                return this._sogou;
            }
            set
            {
                this._sogou = this.sogou;
            }
        }

        public Dictionary<string, string> sogou1
        {
            get
            {
                return this._sogou1;
            }
            set
            {
                this._sogou1 = this.sogou1;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?