Пример #1
0
        /// <summary>
        /// 加载代词匹配模式
        /// </summary>
        /// <param name="fileName"></param>
        private void LoadPronounsPatterns(string fileName)
        {
            string[] lines = File.ReadAllLines(fileName, Encoding.UTF8);
            foreach (string line in lines)
            {
                string[] text = line.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                if (text.Length == 5)
                {
                    PronounsChecker checker = new PronounsChecker();
                    checker.Rule     = text[0];
                    checker.TypeId   = int.Parse(text[1]);
                    checker.TypeFlag = text[2];
                    checker.IsNear   = text[3] == "near";
                    checker.TypeName = text[4];
                    _pronounsPatterns.Add(checker);

                    if (checker.IsNear == false)
                    {
                        _pronounsRemember.Add(checker.TypeFlag + " " + checker.Rule, "");
                    }
                }
            }
        }
        /// <summary>
        /// 加载代词匹配模式
        /// </summary>
        /// <param name="fileName"></param>
        private void LoadPronounsPatterns(string fileName)
        {
            string[] lines = File.ReadAllLines(fileName, Encoding.UTF8);
            foreach (string line in lines)
            {
                string[] text = line.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                if (text.Length == 5)
                {
                    PronounsChecker checker = new PronounsChecker();
                    checker.Rule = text[0];
                    checker.TypeId = int.Parse(text[1]);
                    checker.TypeFlag = text[2];
                    checker.IsNear = text[3] == "near";
                    checker.TypeName = text[4];
                    _pronounsPatterns.Add(checker);

                    if (checker.IsNear == false)
                    {
                        _pronounsRemember.Add(checker.TypeFlag + " " + checker.Rule, "");
                    }
                }
            }
        }