Commit acbfefc
committed
Pin the peel's segment choice and its two boundaries (#308)
A mutation pass found one live survivor on a fully-covered line:
replacing the peel's `state.segments[0]` with `range(len(state.tokens))`
-- the natural simplification, since under NO_COMMA the two runs are
usually identical -- changes real output and fails nothing. Extracted
delimited content is still in the token stream at this stage with only
its role set, so "김민준씨 (Jimmy)" would hand the scan-back Jimmy as
its site: no post-nominal to step over, no tail to peel, and the peel
lost entirely. The comment above the segment lookup made it worse by
saying extracted content is unreachable and that no input can produce
it -- true of the surname half it was written for, actively misleading
for the peel, where the choice is what keeps Jimmy out. Case row plus
both comments.
Two boundaries a reader could otherwise meet by surprise:
- "田中さん, PhD" keeps the whole 田中さん as the family name while
"田中さん PhD" gives family 田中 and suffix "さん, PhD". A one-word
name part before a comma is FAMILY_COMMA, which opts the stage out
by doctrine -- the one spelling disagreement #308 does not remove,
where the 김민준씨 Jr. pair got two rows for removing exactly that.
A case row, so it is a recorded decision.
- The off-switch docs/customize.rst promises was verified and
untested: removing a tail leaves the glued name unsplit while the
spaced spelling still routes the honorific. Pinned at parse level,
against a peel-is-on baseline so it cannot pass vacuously.
And a clause recording why _is_post_nominal is strict rather than
lenient: the initial veto makes "田中さん V." decline where
"田中さん II" peels, which agrees with what classify does with "V."
downstream. Swapping the predicate fails no test; the clause is the
record instead.1 parent 288fef2 commit acbfefc
4 files changed
Lines changed: 73 additions & 2 deletions
File tree
- nameparser/_pipeline
- tests/v2
- tools/differential
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
257 | 266 | | |
258 | 267 | | |
259 | 268 | | |
| |||
285 | 294 | | |
286 | 295 | | |
287 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
288 | 304 | | |
289 | 305 | | |
290 | 306 | | |
| |||
386 | 402 | | |
387 | 403 | | |
388 | 404 | | |
389 | | - | |
390 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
391 | 414 | | |
392 | 415 | | |
393 | 416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
914 | 914 | | |
915 | 915 | | |
916 | 916 | | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
917 | 943 | | |
918 | 944 | | |
919 | 945 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
0 commit comments