For Extra Credit
Start a similar conversation with your LLM of choice to build the name normalizer. Then, see how effective a solution it can produce by prompting a couple more features.
-
Harry Truman had a single-letter middle name, sort of, implying that it should not be abbreviated with a period.
input: Harry S Truman
output: Truman, Harry S
-
If a person has a salutation, it should precede the first name in the result. Known salutations include Dr, Mr, Mrs, Ms, Sir, Miss, Lord, and Esq. Each salutation may optionally be terminated by a period. Retain the period if it exists.
input: Dr. Martin Luther King, Jr.
output: King, Jr., Dr. Martin L.
input: Sir Patrick Stewart
output: Stewart, Sir Patrick
If you really want to get wild, a version supporting ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access