Give a called analyzer its own _ROOT; look up bare words (4.1.1) - #740
Merged
Merged
Conversation
A called analyzer's tree root was the node it was given, under that node's name, sealed, and with siblings in the caller's tree. So @nodes _ROOT and @path _ROOT selected nothing, selects for deeper nodes never descended, and traverseSelect/pathSelect, which walk a root's siblings, could run on the caller's nodes next to it. It now gets a stand-in _ROOT node holding the node's children for the length of the call, and they go back under the node afterwards. CG::findWordConcept returned a word found in memory without consulting lazily loaded *full dictionaries, even when the word had no attributes. Every attribute name is a dictionary word, so bare words are common, and in a called analyzer the KB is shared with the caller: "see", "my" and "get" came out with no part of speech. A bare word is now looked up once. The call-analyzer fixture's callee now uses @nodes _ROOT and @path _ROOT, and its caller leaves "crimson" bare before calling. Co-Authored-By: Claude Opus 5 (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.
What
Two bugs reported while calling EnglishPhrases on a prose zone with
callanalyzer(#739).1.
@NODES _ROOTand@PATH _ROOTmatched nothing in a called analyzer. The called analyzer's tree root was the node it was given, under that node's own name (e.g._PROSEZONE), sealed, and with siblings in the caller's tree. So:@NODES _ROOT/@PATH _ROOTselected nothing, and an analyzer whose passes all use@NODES _ROOTbuilt nothing, silently;traverseSelectandpathSelectwalk a root's right siblings, so a pass could run on the caller's nodes next to the zone.Fix, in
lite/callana.cpponly: for the length of the call the analyzer gets a stand-in_ROOTnode (unsealed, no parent or siblings, spanning the node's text) that holds the node's children; they go back under the node afterwards. This leaves the ~20 select-matching sites in pat/rec/path/multi untouched, and makes a called analyzer select and traverse exactly as on a text of its own.pnroot()in a called analyzer is now that stand-in.2. Bare words were never looked up in lazy
*fulldictionaries.CG::findWordConceptreturned any word found in memory, even one with no attributes. Every attribute name is a dictionary word, so bare words are common, and a called analyzer shares the caller's KB: "see", "my" and "get" came out with no part of speech. A word in memory with no attributes now gets one lazy lookup (cached, so never repeated). A dict hit is merged into the word; a kbb-only hit is linked asmeaning, asfindFullWordalready does.Version bumped to 4.1.1.
Tests
The call-analyzer fixture's callee now uses
@NODES _ROOTand@PATH _ROOT, and its caller makes "crimson" a bare word (as an attribute name) before calling. The previous binary fails it with the reported symptom (nothing built); this build passes.Locally on Windows: all 15 fixture steps in
build-windows.ymlpass, including the rule-level debugger, and parse-en-us'sfinal.treeis byte-identical to the golden copy. parse-en-us has no*fullfiles, so the lookup change is covered by the fulldict-hang step and the fixture; it was not tested apart from fix 1.Help: separate PR in VisualText/visualtext-files; merge it after this ships.
🤖 Generated with Claude Code