Skip to content

Commit 3e5dad6

Browse files
committed
Reach the peel from a drawn lexicon (#308)
The property layer draws honorific_tails and repairs the draw, but _names_using only manufactured `surname + 민준`, so no generated token ever ENDED in a drawn tail and the peel never fired under a drawn lexicon. Instrumented before and after: 14 fires across test_properties.py, all 14 under Lexicon.default() and 0 under a drawn one; deriving the glued token from the draw moves that to 2. Both are ASCII tails on a non-Latin stem ('민준de', '민준and'), which is the one shape that reaches an ASCII tail at all -- the stage bails on a wholly ASCII original. Same failure mode the pool's own comment records having measured and fixed for surnames. The comment now covers both derivations, and no longer states a per-run fire count for the surname half as fact: the same instrumentation shows zero surname-half splits under drawn lexicons in this run, so the honest note is to instrument before concluding either half is exercised.
1 parent acbfefc commit 3e5dad6

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

tests/v2/test_properties.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,24 +311,38 @@ def _names_using(draw: st.DrawFn, lexicon: Lexicon) -> str:
311311
"""
312312
vocab = sorted({w for name in _SET_FIELDS
313313
for w in getattr(lexicon, name)})
314-
# script_segment (#271) is the one stage a space-joined name can
315-
# never reach: it splits an UNSPACED token whose PREFIX is a drawn
316-
# surname, so every drawn surname is also offered concatenated with
317-
# a given name. Waiting instead for a drawn surname and a matching
318-
# literal to coincide left the stage unexercised on all 250
319-
# examples (measured); deriving the token from the draw itself
320-
# reaches it on a handful. A Latin surname makes a mixed-script
321-
# token the stage correctly declines -- useful input in its own
322-
# right.
314+
# script_segment (#271, #308) holds the two halves a space-joined
315+
# name can never reach, and BOTH need their token derived from the
316+
# draw: waiting for a drawn entry and a matching literal to
317+
# coincide leaves the stage unexercised. The surname half splits an
318+
# unspaced token whose PREFIX is a drawn surname; the peel splits a
319+
# listed tail off the END of one. The peel's line was added after a
320+
# mutation pass asked the same question of it and instrumentation
321+
# answered: 14 fires across this file, every one under the DEFAULT
322+
# lexicon and none under a drawn one, because no generated token
323+
# ended in a drawn tail. Deriving it moves that off zero.
324+
# A Latin entry is useful input in its own right: it makes a
325+
# mixed-script token the surname half correctly declines, and for
326+
# the peel it is the one shape that reaches an ASCII tail at all --
327+
# the stage bails on a wholly-ASCII original, so the non-Latin stem
328+
# is what admits '민준jr'. Both fires observed under drawn lexicons
329+
# are of exactly that shape.
330+
# Neither derivation guarantees a fire on any given run: the piece
331+
# is one of ~30 in the pool, so it competes with the bare vocabulary
332+
# words, and a bare drawn surname standing earlier in the name takes
333+
# the surname site before the unspaced token can. Instrument before
334+
# concluding either half is exercised -- the counts above are what
335+
# that costs to find out.
323336
# sorted for the same reason `vocab` above is: frozenset iteration
324337
# order is not stable across runs, and an unsorted pool shifts
325338
# every index sampled_from draws -- which would defeat
326339
# derandomize=True on the whole strategy, not just this slice.
327340
unspaced = sorted(w + "민준" for w in lexicon.surnames)
341+
glued = sorted("민준" + w for w in lexicon.honorific_tails)
328342
# plain names and structure characters are always available, so the
329343
# pool is never empty even for an empty lexicon
330344
pieces = st.sampled_from(
331-
vocab + unspaced + ["John", "Smith", "Q.", ",", "(", "'"])
345+
vocab + unspaced + glued + ["John", "Smith", "Q.", ",", "(", "'"])
332346
return " ".join(draw(st.lists(pieces, min_size=1, max_size=8)))
333347

334348

0 commit comments

Comments
 (0)