Skip to content

Commit 4e91b7a

Browse files
committed
docs: explain why ret/vet are bare (not parenthesized) in SUFFIX_NOT_ACRONYMS
Without this, a future maintainer diffing suffixes.py in isolation could read the (ret)/(vet) removal as an accidental regression and re-add the parenthesized form, silently reintroducing the #111 bug. Flagged by the comment-analyzer subagent during PR review.
1 parent c2efbd8 commit 4e91b7a

1 file changed

Lines changed: 31 additions & 3 deletions

File tree

nameparser/config/suffixes.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,44 @@
1313
'iii',
1414
'iv',
1515
'v',
16+
# Bare, not '(ret)'/'(vet)': moved here from literal parenthesized
17+
# entries in SUFFIX_ACRONYMS. parse_nicknames()'s handle_match() now
18+
# strips parens/quotes before this set is consulted, so the bare form
19+
# is correct -- do not re-add the parenthesized form, that would
20+
# silently reintroduce the #111 bug (parenthesized "(Ret)" matching
21+
# literally instead of going through nickname/suffix disambiguation).
22+
'ret',
23+
'vet',
1624
])
1725
"""
1826
1927
Post-nominal pieces that are not acronyms. The parser does not remove periods
2028
when matching against these pieces.
2129
30+
"""
31+
SUFFIX_ACRONYMS_AMBIGUOUS = set([
32+
# Suffix acronyms that also commonly work as given-name nicknames on
33+
# their own (e.g. "Ed", "JD"). Read only by HumanName.parse_nicknames()
34+
# when deciding whether parenthesized/quoted content is a nickname or a
35+
# suffix -- content matching one of these stays a nickname rather than
36+
# being reclassified as a suffix, since that's the more common reading
37+
# in ambiguous, delimiter-only context.
38+
#
39+
# When adding a new entry to SUFFIX_ACRONYMS, also add it here only if
40+
# the exact letter sequence could plausibly be someone's given name or
41+
# common nickname on its own (e.g. 'jd', 'ed'). Unambiguous
42+
# certifications/degrees (e.g. 'mba', 'cpa', 'phd') don't need an entry.
43+
'ed',
44+
'jd',
45+
])
46+
"""
47+
48+
Acronym suffixes from SUFFIX_ACRONYMS that also plausibly collide with a
49+
common given-name nickname. Not a partition of SUFFIX_ACRONYMS -- a small,
50+
standalone exception list consulted only by parse_nicknames().
51+
2252
"""
2353
SUFFIX_ACRONYMS = set([
24-
'(ret)',
25-
'(vet)',
2654
'8-vsb',
2755
'aas',
2856
'aba',
@@ -501,7 +529,7 @@
501529
'mra',
502530
'ms',
503531
'msa',
504-
'msc'
532+
'msc',
505533
'mscmsm',
506534
'msm',
507535
'mt',

0 commit comments

Comments
 (0)