Query-type semantics: individual-image vs class counts, and image-aware routing#7
Merged
Merged
Conversation
The chat conflated individual-image queries with class queries — it answered
"how many images of neurons with a part in the medulla" with 28 (PartsOf, a
class query = 28 subparts) reported as "28 images", when the real images count
is ImagesNeurons = 226,524. Row id prefixes separate them: individual-image
queries return VFB_* rows (count = images), class queries return FBbt_* rows
whose thumbnails are just examples (count = number of classes).
- Add lib/queryTypes.mjs: per-query_type semantics (kind + countNoun), with
querySemantics()/isIndividualImageQuery().
- Digest (termInfoDigest.mjs): render each count with its unit ("226,524 images",
"471 neuron types", "28 subparts") and a header explaining that class counts
are not image counts and that class thumbnails are examples; include the unit
in the uncounted "run this query" line.
- Routing (orchestrator pickBestQueryForQuestion): for an "images" question,
restrict candidates to individual-image queries so it can never pick a class
query like PartsOf. Tested with the user's exact question (deliberate
"medualla" misspelling).
Tests: queryTypes 4, termInfoDigest 9, orchestrator 23; next lint clean.
…est.json to the newer run)
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.
Follow-up to PR #6 (which merged the count-question auto-run). This commit was pushed just after #6 merged, so it needs its own PR. Targets v3.3.1.
The "28 images" bug
After #6 auto-runs a query, it ran the wrong one: "how many images of neurons with a part in the medulla are available?" answered
28— that'sPartsOf(28 subparts, a class query) reported as "28 images", whenImagesNeurons= 226,524 is the real images count.Row id prefixes separate the two kinds:
VFB_*rows — count = images (ImagesNeurons,ListAllAvailableImages,AllAlignedImages).FBbt_*rows whose thumbnails are just examples — count = number of classes (NeuronsPartHere471,PartsOf28,SubclassesOf).Changes
lib/queryTypes.mjs(new): per-query_typesemantics (kind+countNoun), withquerySemantics()/isIndividualImageQuery().termInfoDigest.mjs): every count renders with its unit ("226,524 images", "471 neuron types", "28 subparts") and a header stating class counts are not image counts and class thumbnails are examples; the uncounted "run this query" line names the unit too.pickBestQueryForQuestion): for an "images" question, restricts candidates to individual-image queries, so it can never pick a class query likePartsOf.Tested with the user's exact question including the deliberate
meduallamisspelling (the term still resolves; matching keys off "images"/"neurons").Tests / lint
queryTypes4,termInfoDigest9,orchestrator23; whole offline unit suite green (19 files);next lintclean.After merge
Tag v3.3.1 on
main. Code delta:lib/orchestrator.mjs,lib/termInfoDigest.mjs, newlib/queryTypes.mjs+ tests (rest is the tracked task-battery snapshots).