Skip to content

Merge a called analyzer's lazy entries into known words (4.1.2) - #741

Merged
ddehilster merged 1 commit into
masterfrom
fix/callanalyzer-merge-lazy
Sep 14, 2026
Merged

ddehilster merged 1 commit into
masterfrom
fix/callanalyzer-merge-lazy

Conversation

@ddehilster

Copy link
Copy Markdown
Member

What

Follow-up to #740, reported by a session calling english-phrases-analyzer from client-reply-analyzer.

A word the calling analyzer's dictionary already defined got none of the called analyzer's lazy *full attributes. 4.1.1 made a word in memory with no attributes get one lazy lookup, but a word with attributes was still treated as done. The caller's replywords.dict defines hello greeting=1, team salutation=1, on attribution=1 and so on, so the called analyzer's en-full.dict never reached those words: hello kept greeting 1 and got no part of speech (on its own, english-phrases-analyzer gives it int, noun, pos num 2).

For an analyzer's own lazy files, skipping a word its dictionary defines is intended, so this is not changed globally. Instead:

  • Lazy files registered by callanalyzer are opened to merge: openFullDict/openFullKBB take merge (default false), stored on FullFile with a per-file set of words already searched.
  • CG::mergeFullWord searches each merge file once per word, whether or not the word is in memory or has attributes, and adds what it holds (dict hits into the word itself; kbb-only hits linked as meaning).
  • findFullDictWord/findFullKBBWord skip merge files, so nothing is searched twice.

An analyzer's own lazy files behave exactly as before. Version bumped to 4.1.2.

One side effect: when both dictionaries give a word the same value (e.g. pos=noun), it is now stored twice, and pos num counts it twice.

Tests

The fixture moves red to the callee's lazy shades-full.dict and gives the caller its own red mood=angry entry; a new output line requires red:angry yes. The 4.1.1 binary fails it (red is not colored and has no color); this build passes.

Locally on Windows: all 15 fixture steps in build-windows.yml pass, including the rule-level debugger, and parse-en-us's final.tree is byte-identical to the golden copy.

Help: separate PR in VisualText/visualtext-files; merge it after this ships.

🤖 Generated with Claude Code

A word already in memory with attributes was never looked up in lazily
loaded *full dictionaries. For an analyzer's own lazy files that is
intended: its in-memory dictionary entry wins. But a called analyzer
shares its caller's KB, and the caller's dictionaries define many of
the same words, so the called analyzer's en-full.dict never reached
them: "hello" kept the caller's greeting=1 and got no part of speech.

Lazy files that callanalyzer registers are now opened to merge
(FullFile::merge). CG::mergeFullWord searches each of them once per
word, whether or not the word is in memory or has attributes, and adds
what they hold; the ordinary lazy search skips them. An analyzer's own
lazy files behave as before.

The fixture moves "red" to the callee's lazy shades-full.dict and gives
the caller its own "red mood=angry" entry; red must end up with both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ddehilster
ddehilster merged commit e542956 into master Sep 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant