// TODO: This can now check sub-formation names /// <summary> /// There is a potential match based on the various formation names. /// </summary> /// <param name="location">The location.</param> /// <returns><c>true</c> if is a potential match based on the various formation names, <c>false</c> otherwise.</returns> private bool potentialMatchByName(Location location) { if (SubFormationName.Contains("Ericsson Crag #3") && (location.Name.Contains("Ericsson Crag #3") || location.OtherName.Contains("Ericsson Crag #3"))) { System.Console.WriteLine("FooBar"); } // First check if any combination of one name contains the other if (eitherContainsOther(FormationName, location.Name) || eitherContainsOther(FormationName, location.OtherName) || eitherContainsOther(SubFormationName, location.Name) || eitherContainsOther(SubFormationName, location.OtherName)) { return(true); } // Next, redo the check with the names singular and made non-possessive string formationNameNormalized = FormationName.ApplyToIndividualWords(singularNonPossessiveWord); string subFormationNameNormalized = SubFormationName.ApplyToIndividualWords(singularNonPossessiveWord); string potentialLocationNameNormalized = location.Name.ApplyToIndividualWords(singularNonPossessiveWord); string potentialLocationOtherNameNormalized = location.OtherName.ApplyToIndividualWords(singularNonPossessiveWord); return(eitherContainsOther(formationNameNormalized, potentialLocationNameNormalized) || eitherContainsOther(formationNameNormalized, potentialLocationOtherNameNormalized) || eitherContainsOther(subFormationNameNormalized, potentialLocationNameNormalized) || eitherContainsOther(subFormationNameNormalized, potentialLocationOtherNameNormalized)); }
/// <summary> /// Check with elevations normalized, e.g. no 13,749 or 13,749', just 13749. /// </summary> /// <param name="formation">The formation.</param> /// <returns><c>true</c> if if there is a match among any of the name combinations, <c>false</c> otherwise.</returns> private bool potentialMatchByNameNumeric(Formation formation) { string formationNameNormalizedNumeric = FormationName.GetNumbers(); string subFormationNameNormalizedNumeric = SubFormationName.GetNumbers(); string potentialFormationNameNormalizedNumeric = formation.Name.GetNumbers(); string potentialFormationOtherNameNormalizedNumeric = formation.OtherName.GetNumbers(); string potentialSubFormationOtherNameNormalizedNumeric = formation.SubFormationName.GetNumbers(); return(eitherContainsOther(formationNameNormalizedNumeric, potentialFormationNameNormalizedNumeric) || eitherContainsOther(formationNameNormalizedNumeric, potentialFormationOtherNameNormalizedNumeric) || eitherContainsOther(formationNameNormalizedNumeric, potentialSubFormationOtherNameNormalizedNumeric) || eitherContainsOther(subFormationNameNormalizedNumeric, potentialFormationNameNormalizedNumeric) || eitherContainsOther(subFormationNameNormalizedNumeric, potentialFormationOtherNameNormalizedNumeric) || eitherContainsOther(subFormationNameNormalizedNumeric, potentialSubFormationOtherNameNormalizedNumeric)); }
/// <summary> /// Check with the names singular and made non-possessive, with other tweaks for geographical name irregularities. /// </summary> /// <param name="formation">The formation.</param> /// <returns><c>true</c> if there is a match among any of the name combinations, <c>false</c> otherwise.</returns> private bool potentialMatchByNameNormalized(Formation formation) { string formationNameNormalized = FormationName.ApplyToIndividualWords(NormalizeGeographicName); string subFormationNameNormalized = SubFormationName.ApplyToIndividualWords(NormalizeGeographicName); string potentialFormationNameNormalized = formation.Name.ApplyToIndividualWords(NormalizeGeographicName); string potentialFormationOtherNameNormalized = formation.OtherName.ApplyToIndividualWords(NormalizeGeographicName); string potentialSubFormationOtherNameNormalized = formation.SubFormationName.ApplyToIndividualWords(NormalizeGeographicName); return(eitherContainsOther(formationNameNormalized, potentialFormationNameNormalized) || eitherContainsOther(formationNameNormalized, potentialFormationOtherNameNormalized) || eitherContainsOther(formationNameNormalized, potentialSubFormationOtherNameNormalized) || eitherContainsOther(subFormationNameNormalized, potentialFormationNameNormalized) || eitherContainsOther(subFormationNameNormalized, potentialFormationOtherNameNormalized) || eitherContainsOther(subFormationNameNormalized, potentialSubFormationOtherNameNormalized)); }