public Framework.AppendList <PositionLength> GetAllMatchs(string text, bool chineseNameIdentify) { Framework.AppendList <PositionLength> result = new Framework.AppendList <PositionLength>(); if (text == null && text == "") { return(result); } string keyText = text; if (text[0] < 128) { keyText = keyText.ToLower(); } for (int i = 0; i < text.Length; i++) { byte[] lenList; char fst = keyText[i]; List <string> chsNames = null; if (chineseNameIdentify) { chsNames = ChineseName.Match(text, i); if (chsNames != null) { foreach (string name in chsNames) { WordAttribute wa = new WordAttribute(name, POS.POS_A_NR, 0); result.Add(new PositionLength(i, name.Length, wa)); } } } WordAttribute fwa; if (_FirstCharDict.TryGetValue(fst, out fwa)) { result.Add(new PositionLength(i, 1, fwa)); } if (i < keyText.Length - 1) { uint doubleChar = ((uint)keyText[i] * 65536) + keyText[i + 1]; if (_DoubleCharDict.TryGetValue(doubleChar, out fwa)) { result.Add(new PositionLength(i, 2, fwa)); } } if (i >= keyText.Length - 2) { continue; } long tripleChar = ((long)keyText[i]) * 0x100000000 + (uint)(keyText[i + 1] * 65536) + keyText[i + 2]; if (_TripleCharDict.TryGetValue(tripleChar, out lenList)) { foreach (byte len in lenList) { if (len == 0) { break; } if (i + len > keyText.Length) { continue; } string key = keyText.Substring(i, len); WordAttribute wa; if (_WordDict.TryGetValue(key, out wa)) { if (chsNames != null) { bool find = false; foreach (string name in chsNames) { if (wa.Word == name) { find = true; break; } } if (find) { continue; } } result.Add(new PositionLength(i, len, wa)); } } } } return(result); }