I have a bunch of human names. They are all “western” names, and I only need American conventions / abbreviations (for example, Mr. instead of the elder for the senior). Unfortunately, the people to whom I send things did not enter their own names, so I can not ask them what they would like to call. I know the gender of each person and his full name, but actually did not understand him more specifically.
Some examples:
- John Smith
- John Smith, Jr.
- John Smith, Jr.
- John Smith XIV
- Dr. John Smith, Ph.D.
I would like to be able to parse parts of each name:
name = Name.new("John Smith Jr.") name.first_name
If I am looking for a "greeting" (perhaps not the best term), then I want here, for 1-4, "Mr. Smith." At 5, I would like to see Dr. Smith, but I will agree to Mr. Smith.
A Ruby gem for this would be ideal. I was inspired to ask for something so strange from Chronic, a Ruby gem that handles time remarkably humanly, allowing me to say it right “last Tuesday” and come up with something reasonable. ”Some corner algorithms would be enough.
I'm trying to deal with some of the problems presented in false programmers believe in usernames
source share