Repository navigation
Reading.languages names the files on in the parse's own Lexicon (#754, 4i-d) - #997
Merged
Merged
Conversation
…, 4i-d) Reading.languages names the files whose reading of that kind is on in the pool the parse's Lexicon compiled from: a choice of languages names the files it reads and not those it drops, a caller's own reading names none, and an add or remove in a caller's log moves the files named. With no choice and no log nothing moves. Lexicon gains a private _files slot, one _ReadingFiles per base, log and choice, hashed by identity and never pickled, which assemble's two memos take as a fourth key, so a hit costs no frame. The default answers from the index rows as before; a choice with no log from the word's rows under choose; a log from the pool built at construction. No parse moves: the snapshot and the agreement records hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 4i-d review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 2, 2026
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.
Part of #754, sub-phase 4i-d, the optional last PR of the
Lexiconsurface work. Three decisions were taken on the proposal for this PR: report the files that are on (not just the chosen ones), apply the same rule to a caller's own add/remove calls, and treat thePh. D.question below separately.What changes
Reading.languages(Token.readingandAmbiguity.alternative) now names the files whose reading of that kind is on in the parse's ownLexicon. Until now it named the files on by default, whatever choice of languages built the parser.Lexicon.default(), no choice, no add/remove calls): nothing changes. None of the 6,531 committed corpus names move. UnderLexicon.empty(), 21 names move: thePh. D.pair goes fromento().pt,denamespt, whilevankeepsnl.mulandunddrop out.Lexicon.default().add("st", kind="generation")namescs hr sk slforJiří Dienstbier st., where it named none.removestops naming the file whose reading it took out.Only
languagesmoves, across the committed corpora (master854087beagainst this branch):ptdefromes fr it nl pttopt;EinANA SILVA E SOUZAfromit pttoptcsMgr.fromen frtocs;st.andml.from()tocsesde,la,delandsantoesenMa.fromen filtoen;Baronfromde en fr nltoenptPh. D.pair, fromento()How
Lexicongains a private_filesslot, a_lexicon._ReadingFiles.lru_cache.Lexicon, or pickled._languagesand_part_languages, take that slot as a fourth key, so a cache hit still costs no frame.languages_of.choose. That is exact, because a choice's preference is decided per word.parser_for(locales.PT): 0.23 ms to 2.5 ms). The per-word path removes it.ParsedName,TokenorReading, so noADDED_INmarker is needed. OldLexiconandParserpickles rebuild the slot on load.Docs
Reading.languagesrelease-log bullet gains the choice sentence. It stays one bullet, since the field itself is new in 3.0.Reading.languagesdocstring anddocs/usage.rstare updated.docs/locales.rstreplaces its "names no file" paragraph with a doctest (ml.andMgr.underlocales.CS).Follow-up (not in this PR)
Ph. D.is merged by a fixed pattern whatever the vocabulary (decisions/phd-merge). So underparser_for(locales.PT, strict=True)orLexicon.empty()it still reads as a credential with sourcevocabulary, while the joinedPhDreads as the family name. It now names no file. An issue is drafted, not yet filed, asking whether the parse or the source should change.Checks
uv run pytest,uv run pytest -n0 -m serial,uv run mypyanduv run ruff checkpass.sphinx-build -b doctestpasses (229 passed), and so doespython -m doctest README.rst.--python 3.15.tests/v2/test_snapshot.pyis unchanged.tools/differential/cldr_agreement.pymatches both records (JA not measured).tools/perf/call_count.py --against 854087be): the reference row goes from 311.48 to 311.72, all of it first-parse cache misses. A second pass reads 311.0 on both trees, and_CALL_BASELINEis unchanged.🤖 Generated with Claude Code