private bool IsUndergroundStation(string advertismentText, string undergroundStation) { if (string.IsNullOrEmpty(advertismentText) || string.IsNullOrEmpty(undergroundStation)) { return(false); } var jaroWinklerAlgorithm = new SimMetricsMetricUtilities.JaroWinkler(); int startIndex = 0, index = 0; do { index = advertismentText.IndexOf(undergroundStation[0], startIndex); if (index != -1) { string checkSubString = index + undergroundStation.Length < advertismentText.Length ? advertismentText.Substring(index, undergroundStation.Length) : advertismentText.Substring(index); double rate = jaroWinklerAlgorithm.GetSimilarity(checkSubString, undergroundStation); if (rate > 0.84) { return(true); } startIndex = index + 1; } } while (index != -1); return(false); }
public void SetUp() { LoadData(); myJaro = new Jaro(); myJaroWinkler = new JaroWinkler(); }