protected List <HitWords> HitWords(string content) { int index; List <HitWords> hits = new List <HitWords>(); foreach (WORDS item in WordsUtility.Words) { if (item.TREE_PATH.Length == 1) { continue; } index = content.IndexOf(item.WORD); if (index == -1) { if (item.FLAG_KEY <= 0 || item.FLAG_KEY >= 12) { continue; } FLAG_WORDS flag = Utility.GetExt(item.FLAG_KEY); string alias = item.WORD.TrimEnd(flag.WORD); if (alias.Length <= 1) { continue; } index = content.IndexOf(alias); if (index == -1) { continue; } HitWords hit = new HitWords(item); if (hits.Exists(x => x.WORD.Contains(alias))) { hit.SCORE = 0.0F; } hits.Add(hit); } else { HitWords hit = new HitWords(item); hit.SCORE += 1.0F / item.TREE_PATH.Length; hits.Add(hit); } } return(hits); }
protected void FixAddressLine(Address address) { if (address == null) { return; } HitWords word = address.Line.LastOrDefault(t => t != null); for (int i = 0; i < word.TREE_PATH.Length - 1; i++) { if (address.Line[i] == null) { WORDS w = Utility.Find(word.TREE_PATH[i + 1]); if (w != null) { address.Line[i] = new HitWords(w); } } } }