Repository navigation
Peel the #671 credential words off a glued name, except 部長; name_usage answers ends-with for CJK - #712
Merged
Conversation
A glued honorific peels only if no real name ends in it (rules.md#W2), and the tool could not ask that: its US sources hold no CJK spelling and its Wikidata arm matches labels exactly. Live SPARQL cannot ask it either -- STRENDS over a name class's labels runs past WDQS's 60s limit even with no person join, and full-text search finds a CJK word only where its tokenizer split it out (4 of the family names ending in 殿). So the CJK labels of eleven name-item classes are fetched once into the cache (list each class's items, then their labels by VALUES batch of 1,000; a batch that overruns is halved, and a stopped build resumes), matched locally, and only the matching items' bearers are counted live. The new row also counts people whose family name ends in the word's head and whose given name is its tail (阿部 + 長 for 部長), and shows each matched item's Q-id so a transcription or mislabel can be traced. The listing comes as CSV (73MB of JSON was cut off mid-stream) and is held to a COUNT taken just before it; lexemes, which carry P31 family name too, are skipped. 429s wait out Retry-After. The Census and SSA rows now say they do not apply to a CJK word. Checked against live STRENDS on 20 class x word cells: identical. Refs #707 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
議員/议员, 国会議員/國會議員, 太平紳士/太平绅士, 医学博士/醫學博士, 二世, 社長/課長 and 社长/课长 join GLUED_HONORIFICS, so 田中社長 reads family 田中, suffix 社長 and 陳怡君二世 gives up 二世. Measured with tools/name_usage.py's new ends-with row: no Wikidata name item ends in any of them (二世's one hit is the given name Odo, mislabelled 厄德二世), and no person pairs a family name ending in the word's head with a given name equal to its tail. 部長/部长 stay spaced-only: 長 alone is a borne given name, so 阿部長 can be 阿部 + 長, and the measured zero is a lower bound that does not refute that. Snapshot: four CLDR renderings and 陳怡君二世 lose the glued word to the suffix; cldr_agreement gains one agreeing suffix field and loses none. The JA locale view, measured with the ja extra, does not move. Closes #707 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cript-707-ea608d # Conflicts: # AGENTS.md
- decisions.md: list 部長/部长 in the honorific_tails Excluded block. Their measurement came back zero like the words that shipped, so without the entry a sweep of the list would add them; the exclusion rests on the 阿部 + 長 argument. - release log: 部長/部长 ARE read after a comma (田中,部長) and under locales.ZH after a listed surname (李部長); the bullet said "only as a separate word". - usage.rst: "no name Wikidata records ends in one of them" was false (厄德二世, the given name Odo); say they are not known to end a name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The #707 vetting asked whether a NAME ends in each word and never whether a longer, unlisted office word does. Common ones do, and the peel matches the end of a token spaced or glued, so 衆議院議員, 副社長, 代表取締役社長 and 獣医学博士 split at the listed tail: 田中 副社長 reads given 副, suffix 社長. Kept (Derek, 2026-10-17): before, the whole word stayed in the name, which was no more right. - rules.md W2: a second Accepted clause with two examples - decisions.md#W2: the cost in the #707 entry, with the older 박사 case (김민준의학박사) it had left unrecorded - suffixes.py: the cost beside the #707 entries - AGENTS.md: a third vetting question, "does a common longer word end in it?", since the corpora hold no compound and the snapshot is silent Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI: since 3.14 an HTTPError left unclosed warns, and the 429 retry dropped each one; it and the overrun path now close the error. False zeros and lost reports: - A class listing no items is refused instead of cached as [], which had made every later ends-with row a silent zero. - Cache files are read through one check: a corrupt or wrongly shaped file raises ValueError naming it and --refresh-index (it raised a KeyError past _attempt, losing every source's answer). A batch records the first and last item it covers and is fetched again when the class's listing no longer matches, rather than answering for other items. - The character class takes supplementary-plane Han (Extension B on) and 〇, and drops the Yijing hexagrams; words are NFC-normalized, so decomposed hangul reaches the row. The cache carries a version and an older one is rebuilt. - A CSV listing that ends mid-line is cut short, not a shorter Q-id. - A failed pairing count fails that pairing (Split.error, exit 2) instead of discarding the row's item counts; pairings are counted in chunks over distinct people, and an empty answer is zero by construction rather than a default. - NAME_CLASSES roles are checked at import; a typo had silently dropped a class from the pairing count. - --refresh-index loads the index for a Latin word too. Tests for each, plus the reviewers' gaps: two classes in one build, every cut of a longer word, the count's slack at both edges, 429 exhaustion and date-form Retry-After, a non-429 error, chunked country sums, 502 and IncompleteRead as overruns, the CSV Accept header. Docs: the corpora now hold the two compound examples; NAME_CLASSES' comment matched to the measured overlap; one build time; 長's item is a Chinese given name; the #671 entry points to #707; index entries, not labels; usage.rst says how 部長 and compounds read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #712 +/- ##
=======================================
Coverage 99.03% 99.03%
=======================================
Files 46 46
Lines 4557 4557
=======================================
Hits 4513 4513
Misses 44 44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
derek73
added a commit
that referenced
this pull request
Oct 18, 2026
Stale whole batches no longer shadow their cached halves; batches are keyed by a digest of their whole membership; a failed --refresh-index is reported for Latin words; HTTPErrors are closed on every path; the CJK class reaches Extension H (INDEX_VERSION 3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #707.
What changes
tools/name_usage.pycan now answer "does any name END in this word?" for a CJK word. That is the question the glued-honorific peel rests on (rules.md#W2). The Census and SSA rows now say they do not apply to a CJK word, and a new row,Wikidata people, name ends with, gives:陳怡君二世and田中医学博士lose their glued credential word?name_usagecannot answer for CJK words #707 raised against 部長.The #671 words peel off a glued name, except 部長/部长. 議員/议员, 国会議員/國會議員, 太平紳士/太平绅士, 医学博士/醫學博士, 二世, 社長/課長 and 社长/课长 join
GLUED_HONORIFICS. 部長/部长 stay spaced-only on the 阿部 + 長 argument.田中社長田中社長田中, suffix社長陳怡君二世(locales.ZH)陳, given怡君二世陳, given怡君, suffix二世エリザベス二世エリザベス二世エリザベス, suffix二世田中部長田中部長How the tool answers it
Live SPARQL can't:
STRENDSover every label of a name class timed out at WDQS's 60s limit even with no person join, and WDQS full-text search found 4 family names ending in 殿, matching only where its tokenizer split the character out. So:COUNTtaken just before it, because 73MB of JSON was cut off mid-stream and CSV has no closing bracket to show a cut. Lexemes, which also carryP31 family name, are skipped.VALUESbatch of 1,000 items, keeping CJK-script labels only. Slicing a class by Q-id suffix inside one query doesn't work, because it scans the whole class every time. A batch that overruns is halved. Finished batches are cached, so a stopped build resumes; 429 responses wait outRetry-After.The first build took 33 minutes: 215,798 labels on 128,695 items, cached outside the repo. Later runs take seconds;
--refresh-indexrebuilds.Measurements (2026-10-17)
STRENDSexactly on 20 class × word cells (five subclasses × 殿, 子, 郎, 田; the largest cell had 403 items).陳怡君二世and田中医学博士lose their glued credential word?name_usagecannot answer for CJK words #707 words: no name item ends in any of the 15 spellings, except one mislabel: the given name Odo (Q18339792), whose Chinese label is 厄德二世, with 109 Western bearers. Every boundary pair that exists (二+世, 社+長, 社+长, 部+長, 部+长) counts 0 people.陳怡君二世, each losing the glued word to the suffix. cldr_agreement gains one agreeing suffix field (二世 醫學博士) and loses none. The JA locale view, run with thejaextra, doesn't move.Docs
王雅婷,議員reads given議員,陳怡君二世reads given怡君二世#671 bullet is in the same Unreleased block, so it is merged with this changeCommits
5faae975the tool (its tests pass on their own)e70b8342the vocabulary change, case rows, records and docs41e0727amerge of master (Ivoi, Paul d'andZaʿīm, Ḥusnī az-: a particle written after the given name isn't joined to the family #700); AGENTS.md conflict resolved keeping both additions05087fe8,567b9452the review fixes aboved6531ef7,45e24510the PR-review fixes belowPR review (code, tests, silent failures, comments, types)
Fixed in
d6531ef7:HTTPErroris left unclosed, and the 429 retry discarded errors without closing them. The retry loop and the overrun path now close each error. The tool tests pass under 3.14.7 and 3.15.0.[];ValueErrorthat names the file and--refresh-index, rather than aKeyErrorthat took every source's answer down;NAME_CLASSESroles are checked at import.The rebuilt index (215,820 entries) gives the same answers for 殿, every #707 word and the boundary pairs.
Design-docs review
The eleven-axis review ran on
41e0727aand found four doc problems, all fixed:田中 副社長reads given副, suffix社長, and岸田文雄衆議院議員reads family岸田文雄衆議院, suffix議員; 獣医学博士 and 副課長 split the same way. Before, the whole word stayed in the name, which was no more right. Recorded in rules.md W2 (a second Accepted clause), the Can陳怡君二世and田中医学博士lose their glued credential word?name_usagecannot answer for CJK words #707 decisions entry and suffixes.py. AGENTS.md's vetting recipe gains the question "does a common longer word end in it?". (567b9452)honorific_tailsExcluded block. (05087fe8)locales.ZHafter a listed surname. (05087fe8)05087fe8)🤖 Generated with Claude Code