New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First name is a known prefix #20
Comments
I am encountering the same problem. I tried to go into the base file and amend it to remove reference to the prefix that was actually a name and the file is read-only. My knowledge on using Visual Studio 2022 is a bit limited - and I have no idea if this is done on your end to protect the project or something that Visual Studio is doing? For the poster above, if you go to your program, hold down CTRL - and then click on HumanName the class variable - it should open up the NameParser.HumanName file and there you will find a list of all the prefixes, titles, suffixes that are being used - "del" is in prefixes. You may be able to amend them there, although I couldn't. |
Kaotic3, I do not want the prefix removed; it is valid. Removing it would incorrectly impact other names. We need a way to determine when a prefix is a first name instead of a prefix. |
I agree that "del" shouldn't be removed from the prefixes, but handling this case isn't clear-cut. The input "Mr. Del Richards" could be reasonably understood to be
The last two options seem the least bad. It still requires the caller disambiguate, but they should know their data better than I do, and I can't think of any better way to handle it. |
I would not modify the configuration lists. With my data removing the Del prefix would fix the one record but cause two others to be incorrect. I know in my data, I should always have a first name so that a PreferFirstOverPrefix could work. But how would Mr. David M Del Rio be parsed if PreferFirstOverPrefix is selected? I am sure you are a lot more knowledgeable about names than I am. |
The ability to modify configuration now exists (in the source code, not yet in the NuGet package), but you're not obligated to use this. I'm also adding in a public void FirstNameIsPrefix()
{
// Default behavior
var parsed_prefix = new HumanName("Mr. Del Richards");
Assert.AreEqual(parsed_prefix.Title, "Mr.");
Assert.AreEqual(parsed_prefix.First, "");
Assert.AreEqual(parsed_prefix.Last, "Del Richards");
Assert.AreEqual(parsed_prefix.LastPrefixes, "Del");
// A single prefix should be treated as a first name when no first exists
var parsed_first = new HumanName("Mr. Del Richards", Prefer.FirstOverPrefix);
Assert.AreEqual(parsed_first.Title, "Mr.");
Assert.AreEqual(parsed_first.First, "Del");
Assert.AreEqual(parsed_first.Last, "Richards");
Assert.AreEqual(parsed_first.LastPrefixes, "");
} Does this fit your needs? |
I think that would fit my requirements. Thank you. |
The new version is available on nuget. You should be able to install with |
Thank you so much for your help. Update works great and all names are parsed as expected. |
I greatly appreciate your project. In the data I am using I have a Mr. Del Richards. The last name returns Del Richards as del is listed in prefixes. However, Del is his first name. I am thinking that it could treat the prefix as the first name if there is not a first name, but there would be times no first name could be included. Any thoughts how to parse this one name correctly?
The text was updated successfully, but these errors were encountered: