public ChineseAddress Parse(String str) { str = str.Replace(".", "").Replace(",", "").Replace(",", ""); MatchingString ms = new MatchingString(str); ms_headwordmatch.Process(ms); ChineseAddress ca = new ChineseAddress(); ca.source = str; ca.nation = ms.GetStringByWordmatch(ms_nationwordmatch); ca.province = ms.GetStringByWordmatch(ms_provincewordmatch); ca.city = ms.GetStringByWordmatch(ms_citywordmatch); ca.district = ms.GetStringByWordmatch(ms_districtwordmatch); ca.county = ms.GetStringByWordmatch(ms_countywordmatch); if (ms.GetStringByWordmatch(ms_streetwordmatch) != null) { ca.street = ms.GetStringByWordmatch(ms_streetwordmatch); } else { ca.street = ms.GetStringByWordmatch(ms_roadwordmatch); } ca.number = ms.GetStringByWordmatch(ms_numberwordmatch); ca.plaza = ms.GetStringByWordmatch(ms_plazawordmatch); ca.ip = ms.GetStringByWordmatch(ms_industrialparkwordmatch); ca.town = ms.GetStringByWordmatch(ms_townwordmatch); ca.village = ms.GetStringByWordmatch(ms_villagewordmatch); //ca.notes = ms.GetStringsByWordmatch(ms_notewordmatch); //ca.noises = ms.GetStringsByWordmatch(ms_noisecollector); return(ca); }
public void Process(MatchingString ms) { if (resolve(ms)) { done(ms); } else if (next != null) { next.Process(ms); } else { fail(ms); } }