public ParsedFullName Parse(string rawName) { var match = Rx.Match(rawName); if (!match.Success) { return(null); } var pn = new ParsedFullName { DisplayName = rawName, Score = 50, Rule = nameof(SingleNameOnlyPattern) }; var matchedName = match.Groups["first"].Value; if (LastNames.Contains(matchedName)) { pn.LastName = matchedName; } else { pn.FirstName = matchedName; } return(pn); }
/// <summary> /// Returns a value indicating whether the provided string corresponds to a common last /// name in the English language. Lookups are performed in a case insensitive manner and /// currently do not respect plurality. /// </summary> /// <param name="text">The Name to lookup</param> /// <returns> /// <c>true</c> if the provided string corresponds to a common last name in the English /// language; otherwise, <c>false</c>. /// </returns> public bool IsLastName(string text) => LastNames.Contains(text);