You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enforce the bound-given/never-given-particle invariant on Lexicon
nameparser/config/prefixes.py asserts two invariants on its own data:
NON_FIRST_NAME_PREFIXES stays a subset of PREFIXES, and stays disjoint
from BOUND_FIRST_NAMES. Only the first had a 2.0 counterpart --
particles_ambiguous <= particles is checked on every Lexicon, while the
disjointness rule guarded nameparser's shipped vocabulary and nothing a
caller supplied.
In 2.0's complement model the second reads as
bound_given_names & particles <= particles_ambiguous
"a bound given name that is also a particle must be one that may start a
given name". A particle declared never-to-start-a-given-name cannot also
bind one; before this, the contradiction resolved by discarding the
never-given declaration at leading position, with no signal.
Note the import-time assert only protects the shipped data, and vanishes
under python -O. This check runs on every Lexicon.
v1 compatibility, as with given_name_titles: v1 has no runtime guard, so
a caller can add a never-given prefix to bound_first_names, and 1.4 then
lets the bound rule win -- "dos Santos Silva" parses first="dos Santos".
The shim reproduces that by promoting such a word to may-be-given rather
than raising on a config v1 accepted. Verified byte-identical to a live
1.4.0 for both the leading and non-leading positions, and pinned by
test_snapshot_keeps_a_bound_never_given_prefix_parseable -- the hole had
no coverage, since no existing test built that combination.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments