示例#1
0
        static private string InitialCleaning(string legalBasis)
        {
            var temp = EmpiriaString.TrimAll(legalBasis);

            temp = temp.Replace(",", ", ");
            temp = temp.Replace(")", ") ");
            temp = temp.Replace(" , ", ", ");
            temp = temp.Replace(". ", " ");

            temp = EmpiriaString.TrimAll(temp);

            temp = EmpiriaString.TrimControl(temp);

            temp = EmpiriaString.RemoveEndPunctuation(temp);

            if (temp.StartsWith("No aplica"))
            {
                return(String.Empty);
            }

            if (EmpiriaString.DamerauLevenshteinProximityFactor(temp, "No aplicable") > 0.70m)
            {
                return(String.Empty);
            }

            return(EmpiriaString.TrimAll(temp));
        }
    private string SearchSettlementsCommandHandler() {
      int municipalityId = int.Parse(GetCommandParameter("municipalityId", true));
      string name = GetCommandParameter("name", true);

      GeographicRegionItem municipality = GeographicRegionItem.Parse(municipalityId);
      ObjectList<GeographicRegionItem> list = GeographicItemValidator.SearchSettlements(municipality, name, 0.75m);

      string temp = String.Empty;
      foreach (GeographicRegionItem region in list) {
        string item = region.Id.ToString() + " " + region.Name + " " + region.ObjectTypeInfo.DisplayName;
        item += " (DL " + EmpiriaString.DamerauLevenshteinProximityFactor(region.Name, name).ToString("P2") + " - ME ";
        item += EmpiriaString.MongeElkanProximityFactor(EmpiriaString.DistanceAlgorithm.DamerauLevenshtein, region.Name, name).ToString("P2") + " - J ";
        item += EmpiriaString.JaroProximityFactor(region.Name, name).ToString("P2") + " - JW ";
        item += EmpiriaString.JaroWinklerProximityFactor(region.Name, name).ToString("P2") + ") ";

        temp += item + "|";
      }
      return temp.Trim('|');
    }