public PosBinRule(CPOS pos) { _POS = pos; _PosBinTbl = new Hashtable(); foreach (T_POSBin bin in _PosBins) { _PosBinTbl[bin.HashCode] = true; } }
protected WordSeg() { _MatchName = false; _FilterStopWords = false; _MatchDirection = T_Direction.LeftToRight; _ExtractWords = new CExtractWords(); _ExtractWords.CompareByPosEvent = CompareByPos; _POS = new CPOS(); _LastSaveTime = DateTime.Now; InitRules(); }
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; } }
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); } }
public MergeNumRule(CPOS pos) { _POS = pos; }