Skip to content

Commit 30d478b

Browse files
committed
refactor: move SUFFIX_ACRONYMS_AMBIGUOUS above the ~530-entry SUFFIX_ACRONYMS
Easier to find right after SUFFIX_NOT_ACRONYMS instead of scrolling past the large acronym list.
1 parent e3ffbc8 commit 30d478b

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

nameparser/config/suffixes.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@
2121
Post-nominal pieces that are not acronyms. The parser does not remove periods
2222
when matching against these pieces.
2323
24+
"""
25+
SUFFIX_ACRONYMS_AMBIGUOUS = set([
26+
# Suffix acronyms that also commonly work as given-name nicknames on
27+
# their own (e.g. "Ed", "JD"). Read only by HumanName.parse_nicknames()
28+
# when deciding whether parenthesized/quoted content is a nickname or a
29+
# suffix -- content matching one of these stays a nickname rather than
30+
# being reclassified as a suffix, since that's the more common reading
31+
# in ambiguous, delimiter-only context.
32+
#
33+
# When adding a new entry to SUFFIX_ACRONYMS, also add it here only if
34+
# the exact letter sequence could plausibly be someone's given name or
35+
# common nickname on its own (e.g. 'jd', 'ed'). Unambiguous
36+
# certifications/degrees (e.g. 'mba', 'cpa', 'phd') don't need an entry.
37+
'ed',
38+
'jd',
39+
])
40+
"""
41+
42+
Acronym suffixes from SUFFIX_ACRONYMS that also plausibly collide with a
43+
common given-name nickname. Not a partition of SUFFIX_ACRONYMS -- a small,
44+
standalone exception list consulted only by parse_nicknames().
45+
2446
"""
2547
SUFFIX_ACRONYMS = set([
2648
'8-vsb',
@@ -653,25 +675,3 @@
653675
when matching against these pieces.
654676
655677
"""
656-
SUFFIX_ACRONYMS_AMBIGUOUS = set([
657-
# Suffix acronyms that also commonly work as given-name nicknames on
658-
# their own (e.g. "Ed", "JD"). Read only by HumanName.parse_nicknames()
659-
# when deciding whether parenthesized/quoted content is a nickname or a
660-
# suffix -- content matching one of these stays a nickname rather than
661-
# being reclassified as a suffix, since that's the more common reading
662-
# in ambiguous, delimiter-only context.
663-
#
664-
# When adding a new entry to SUFFIX_ACRONYMS, also add it here only if
665-
# the exact letter sequence could plausibly be someone's given name or
666-
# common nickname on its own (e.g. 'jd', 'ed'). Unambiguous
667-
# certifications/degrees (e.g. 'mba', 'cpa', 'phd') don't need an entry.
668-
'ed',
669-
'jd',
670-
])
671-
"""
672-
673-
Acronym suffixes from SUFFIX_ACRONYMS that also plausibly collide with a
674-
common given-name nickname. Not a partition of SUFFIX_ACRONYMS -- a small,
675-
standalone exception list consulted only by parse_nicknames().
676-
677-
"""

0 commit comments

Comments
 (0)