Repository navigation
fix(lite): allow multiple *-full lazy dictionaries open at once (3.2.1) - #650
Merged
Merged
Conversation
The lazy "*full" loader kept a single open stream per kind (one
fullDictStream_, one fullKBBStream_), so opening a second *-full.dict
(eg en-firstnames-full.dict alongside en-full.dict) closed and replaced
the first. Only the last-opened full dict stayed active, so words from
the others never got their attributes attached.
Hold each kind in a std::list<FullFile> (stream + size + path + kbb
root) and search across all open files, returning the first match.
findFull{KBB,Dict}Word now loop over the list; the per-file binary
search lives in search{KBB,Dict}File. Verified: David/Jim pick up
name/gender from en-firstnames-full.dict while other words still get
pos + meaning from en-full.dict/en-full.kbb.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
The lazy
*-fulldictionary loader (shipped in #649 / v3.2.0) kept a single open stream per kind — onefullDictStream_, onefullKBBStream_. Opening a second*-full.dict(e.g.en-firstnames-full.dictalongsideen-full.dict) closed and replaced the first, so only the last-opened full dict stayed active. Words from the others never got their attributes attached.Fix
Hold each kind in a
std::list<FullFile>(stream + size + path + kbb root) and search across all open files, returning the first match.findFull{KBB,Dict}Wordnow loop over the list; the per-file binary search lives insearch{KBB,Dict}File. (std::list, notvector, becausestd::ifstreamisn't movable.)The nested
FullFilestruct is declared and defined in a single access region so it compiles cleanly on GCC/Linux (the naive layout tripped MSVC C4240, which GCC rejects outright).Verification
Ran the
TestEnFullKbbanalyzer with all three full files (en-full.kbb,en-full.dict,en-firstnames-full.dict) open at once:David/Jim→("name" "first") ("gender" "male")fromen-firstnames-full.dict("meaning" concept:…)fromen-full.dict/en-full.kbbVersion bumped to 3.2.1.
🤖 Generated with Claude Code