Repository navigation
Look a word up without a ZWNJ or ZWJ typed at its edge (#1335) - #1522
Merged
Merged
Conversation
A zero-width non-joiner or joiner at a word's edge shapes nothing, so _normalize strips it with the edge full stops when a word is looked up or stored, and the name match's fold drops it alike. The token keeps the character, so a field still holds what the caller wrote. A joiner inside a word is untouched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…se log (#1335) decisions/T1 gains a standing line and a 2026-11-21 entry with the corpus measurement, the shapes left open (a word of nothing but joiners, a leading joiner on a Hangul word) and the interior joiner declined for now; rules/T1's Accepted bullet says the word is looked up without an edge joiner; nameparser/AGENTS.md's encoding sweep records the three questions a character the fold strips raises. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iew's gaps (#1335) The match folds a hyphenated family name's halves apart, so a fold that kept a ZWNJ before the hyphen read Smith-Jones typed with one as part-of-other against Smith-Jones; a hyphen is now an edge too. Adds rows for the dotted suffix, a title phrase, a maiden marker, a particle, a family-first order, the other comma shapes, case repair and the familiar-form index; corrects decisions/T1's count of the moves a lookup cannot reach (25, not 31), states the recipe, marks #851's exclusion superseded in part, and cites rules/T1 from _lexicon. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A zero-width non-joiner (U+200C) or joiner (U+200D) at a word's edge shapes nothing. Until now it stayed in the token, so the word missed the vocabulary. This PR drops it where a word is looked up and keeps it in the token text.
Closes #1335
What changes
_lexicon._normalizestrips an edge ZWNJ or ZWJ along with the edge full stops, in a non-ASCII word only, and still reaches a fixed point.Drtyped with a ZWNJ after it,John Smith Jrwith a ZWJ, and the issue's Persianمهندسwith a ZWNJ now read as the title or suffix. 1.4.0 through 3.1.0 read them as given or family; each newtests/v2/cases.pyrow was checked against both wheels.test_an_edge_joiner_stays_in_the_token_text)._lexicon._folddrops a joiner beside whitespace, a hyphen or the text's edge, soعلیtyped with a ZWNJ againstعلیreadsfolded. Master read them as a conflict._normalizealone at first, and review found that the match then read two spellings as a listed one that no list held. Reverting the_foldhalf alone fails 4 match rows; reverting the_normalizehalf alone fails 16 rows.Smithtyped with a ZWNJ before-Jonesreadpart-of-otheragainstSmith-Jones(found by review; whitespace-only edges fail 2 rows)._normalizestill treats a hyphen as inside the token.add()s with an edge joiner is stored without it, and the lexicon pickles. ALexiconpickled on master holding such a word is refused on load, as Should Persian titles and Persian spellings of the Arabic ones read as titles? (دکتر محمد رضاییgives given 'دکتر') #1151's tatweel pickle was. Checked by pickling under 507a64e and loading here.آیتاللهwith its ZWNJ. Folding an interior joiner away is declined for now in decisions/T1 (separators, not joiners).Measured (2026-11-21, against a 507a64e worktree)
Each local-corpus name holding an edge joiner was parsed in both trees, comparing fields with their edge joiners removed. Counts only: no
jrc-namesname is quoted here or kept outside the cache.No committed corpus name moves. The snapshot re-record adds one entry, rules/T1's new example, new to
corpus_rules.jsonl.The 25 a lookup cannot reach (the 8 and 17 in the last column) are left open, as two shapes:
Jane Doe . The joiner takes the family andDoereads middle; this is a tokenizer question.The shape tests still see an edge joiner: H2's period abbreviation (
Insp.), the unlisted dotted and capitals credentials, the numeralVI, a trailing title read with its period, a glued honorific (김민준씨), and rules/W1's surname split (김민준). A sweep found them:Frames: identical in both trees for the reference row (229) and
Smith, John(98), since both changes are C-level. The ±2% band and the serial scaling rows pass.match_diff.py --base: 1,478 of 691,064 rows moved (31,412 pairs × 22 settings), only in the intended directions:conflict→folded: 110;Every listed example is one of this PR's own test rows. The key guarantee holds: 0 consistent pairs share no key.
Docs
Review
The PR review toolkit aspects run on this PR: code-reviewer, comment-analyzer, pr-test-analyzer, and design-docs-reviewer for
docs/design/. silent-failure-hunter was skipped: the change adds no error handling.Findings and fixes:
implemented:with a citation in_lexicon. Fixed.A second code-review pass over the fix commit found nothing at 80% confidence; its one wording nit is fixed in 783fe98.
🤖 Generated with Claude Code