Пример #1
0
        public PosBinRule(CPOS pos)
        {
            _POS       = pos;
            _PosBinTbl = new Hashtable();

            foreach (T_POSBin bin in _PosBins)
            {
                _PosBinTbl[bin.HashCode] = true;
            }
        }
Пример #2
0
 protected WordSeg()
 {
     _MatchName       = false;
     _FilterStopWords = false;
     _MatchDirection  = T_Direction.LeftToRight;
     _ExtractWords    = new CExtractWords();
     _ExtractWords.CompareByPosEvent = CompareByPos;
     _POS          = new CPOS();
     _LastSaveTime = DateTime.Now;
     InitRules();
 }
Пример #3
0
        public MatchName(CPOS pos)
        {
            _PosBinRule     = new PosBinRule(pos);
            _Pos            = pos;
            _ChsNameTraffic = new CChsNameTraffic();

            _FamilyNameTbl = new Hashtable();
            foreach (String familyName in FAMILY_NAMES)
            {
                _FamilyNameTbl[familyName] = true;
            }
        }
Пример #4
0
        public int ProcRule(List <String> preWords, int index, List <String> retWords)
        {
            String word = (String)preWords[index];
            bool   isReg;
            int    pos = CPOS.GetPosFromInnerPosList(_POS.GetPos(word, out isReg));
            String num;

            if ((pos & (int)T_POS.POS_A_M) == (int)T_POS.POS_A_M)
            {
                num = word;
                int i = 0;

                for (i = index + 1; i < preWords.Count; i++)
                {
                    String next    = (String)preWords[i];
                    int    nextPos = CPOS.GetPosFromInnerPosList(_POS.GetPos(next, out isReg));
                    if ((nextPos & (int)T_POS.POS_A_M) == (int)T_POS.POS_A_M)
                    {
                        num += next;
                    }
                    else
                    {
                        break;
                    }
                }

                if (num == word)
                {
                    return(-1);
                }
                else
                {
                    retWords.Add(num);

                    return(i);
                }
            }
            else
            {
                return(-1);
            }
        }
Пример #5
0
 public MergeNumRule(CPOS pos)
 {
     _POS = pos;
 }