python-nameparser
python-nameparser copied to clipboard
Handling conjunctions when input length is short
The following condition causes single letter conjunctions '&' to not behave the same as multi letter conjunctions in the default conjunctions list. This issue only happens when parsing a name that results in the total_length being less than 4. Example is "mr. and mrs. john smith" parses differently than "mr. & mrs. john smith".
{'title': 'mr.', 'first': '&', 'middle': 'mrs. john', 'last': 'smith', 'suffix': '', 'nickname': ''}
This is what I expect the parser to output.
{'title': 'mr. & mrs.', 'first': 'john', 'middle': '', 'last': 'smith', 'suffix': '', 'nickname': ''}
The condition should always respect any single characters inside the configured conjunctions list.
https://github.com/derek73/python-nameparser/blob/759a1316f2fda4395714f36d777fd014dcdd51b0/nameparser/parser.py#L848