feat: add positional and spatial AX signals to lexical scoring#19
Merged
luigi-agosti merged 2 commits intomainfrom Apr 11, 2026
Merged
feat: add positional and spatial AX signals to lexical scoring#19luigi-agosti merged 2 commits intomainfrom
luigi-agosti merged 2 commits intomainfrom
Conversation
- add PositionalHints (depth, sibling index/count, labelled_by) to ElementDescriptor - parse positional metadata from snapshot JSON (flat and nested forms) - add label-association boost and sibling-uniqueness boost to lexical matching - add depth-based deterministic tie-break for equal scores - add unit tests for label boost, sibling uniqueness, depth tie-break, and snapshot propagation Closes #7
luigi-agosti
reviewed
Apr 4, 2026
Drop labeled_by (American spelling) fallback, keeping only labelled_by per W3C ARIA spec (aria-labelledby).
6128ee7 to
236ceb5
Compare
luigi-agosti
approved these changes
Apr 11, 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.
Summary
PositionalHintsto element descriptors (Depth,SiblingIndex,SiblingCount,LabelledBy)positional) shapesLabelledBySiblingCount == 1)Depth(deeper preferred), then sibling index/ref for stable orderingIssue
Closes #7
Acceptance Mapping
labelled_by/labeled_by)Validation
go test ./internal/engine -run "SectionContext|LabelledByBoost|SiblingUniqueness|DepthBreaksEqualScores|ActionQueryPrefersInteractiveElement" -count=1 -vgo test ./cmd/semantic -run LoadSnapshot -count=1 -vgo test . -run "Composite|PositionalHints" -count=1 -vgo test ./... -count=1Web-derived snapshot spot checks (manual)
semantic find "work email input" --snapshot testdata/snapshots/login-page.json --format jsonsemantic find "search wikipedia" --snapshot testdata/snapshots/wikipedia-article.json --format jsonsemantic find "pull requests tab" --snapshot testdata/snapshots/github-repo.json --format json