示例#1
0
        /// <summary>
        /// 获取实例
        /// </summary>
        /// <returns> </returns>
        public static Participle GetInstance()
        {
            string serializedFile = "Init\\HMMParticiple.ser";

            if (_participle == null && File.Exists(serializedFile))
            {
                _participle = Serializer.DeserializeFromFile <Participle>(serializedFile);
            }
            else if (_participle == null)
            {
                _participle = new Participle();
                Serializer.SerializeToFile(_participle, serializedFile);
            }
            return(_participle);
        }
示例#2
0
        public static void Test(string content = "")
        {
            Participle instance = GetInstance();

            if (content.Length < 1)
            {
                Console.WriteLine(instance.Split("你好世界!"));
                Console.WriteLine(instance.Split("杭州都下雪啦!"));
                Console.WriteLine(instance.Split("我的心痛竟是你的快乐!"));
                Console.WriteLine(instance.Split("可是我不想对你念念不舍!"));
                Console.WriteLine(instance.Split("但什么让我辗转反侧!"));
                // Console.WriteLine(
                //    participle.Split(
                //        "【武汉地铁站冠名全被取消】煮熟的鸭子飞走了!即将开通的武汉地铁2号线,包括周黑鸭在内的9个车站冠名,将全部取消。已经挂出的标识,正式开通前都会更改过来。花2700万竞得冠名权的7家企业,部分已接到通知,周黑鸭很淡定。网友建议,冠名应该听听市民的意见。武汉晚报"));
                // Console.WriteLine(participle.Split("Hello World!"));
            }
            else
            {
                Console.WriteLine(instance.Split(content));
            }
        }
示例#3
0
 /// <summary>
 /// 获取实例
 /// </summary>
 /// <returns> </returns>
 public static Participle GetInstance(string dir = "")
 {
     string serializedFile = dir + "participle.Ser.global";
     if (_participle == null && File.Exists(serializedFile))
     {
         _participle = Serializer.DeserializeFromFile<Participle>(serializedFile);
     }
     else if (_participle == null)
     {
         _participle = new Participle();
         Serializer.SerializeToFile(_participle, serializedFile);
     }
     return _participle;
 }
示例#4
0
 /// <summary>
 /// 获取实例
 /// </summary>
 /// <returns> </returns>
 public static Participle GetInstance()
 {
     string serializedFile = "Init\\HMMParticiple.ser";
     if (_participle == null && File.Exists(serializedFile))
     {
         _participle = Serializer.DeserializeFromFile<Participle>(serializedFile);
     }
     else if (_participle == null)
     {
         _participle = new Participle();
         Serializer.SerializeToFile(_participle, serializedFile);
     }
     return _participle;
 }