Define the local evaluation task
A synthetic knowledge task supplies the current document context, an abbreviation token and separate context glossaries. Resolve only the exact token in the selected glossary; the same token in another glossary supplies no fallback. The result keeps its context so a caller can see where the expansion came from.
- Select the supplied document context
- Look up the token only in its glossary
- Return expansion with provenance or a gap
Missing context or token stays unresolved, even if another glossary has a match.
Use the filled cases
| Case | Supplied input | Expected structured output | Decision and reason |
|---|---|---|---|
| Warehouse CT | {"context":"warehouse","token":"CT","glossaries":{"warehouse":{"CT":"carton"},"training":{"CT":"class time"}}} | {"status":"resolved","context":"warehouse","expanded":"carton"} | The warehouse glossary supports carton; training has a different expansion. |
| Training CT | {"context":"training","token":"CT","glossaries":{"warehouse":{"CT":"carton"},"training":{"CT":"class time"}}} | {"status":"resolved","context":"training","expanded":"class time"} | The selected training context changes the applicable expansion. |
| Selected glossary lacks token | {"context":"warehouse","token":"LT","glossaries":{"warehouse":{"CT":"carton"},"training":{"LT":"lesson time"}}} | {"status":"unknown-token","context":"warehouse"} | Training’s LT cannot fill a missing warehouse entry. |
Work the no-token-fallback case. Which output is required, and why?
Show the worked answer
{"status":"unknown-token","context":"warehouse"} — Training’s LT cannot fill a missing warehouse entry.
Run the self-contained evaluator
import assert from 'node:assert/strict';
function evaluate(x){
if(!Object.hasOwn(x.glossaries,x.context))return {status:'unknown-context'};
const g=x.glossaries[x.context];return Object.hasOwn(g,x.token)?{status:'resolved',context:x.context,expanded:g[x.token]}:{status:'unknown-token',context:x.context};
}
const cases = [
{
"id": "warehouse-ct",
"input": {
"context": "warehouse",
"token": "CT",
"glossaries": {
"warehouse": {
"CT": "carton"
},
"training": {
"CT": "class time"
}
}
},
"expected": {
"status": "resolved",
"context": "warehouse",
"expanded": "carton"
}
},
{
"id": "training-ct",
"input": {
"context": "training",
"token": "CT",
"glossaries": {
"warehouse": {
"CT": "carton"
},
"training": {
"CT": "class time"
}
}
},
"expected": {
"status": "resolved",
"context": "training",
"expanded": "class time"
}
},
{
"id": "no-token-fallback",
"input": {
"context": "warehouse",
"token": "LT",
"glossaries": {
"warehouse": {
"CT": "carton"
},
"training": {
"LT": "lesson time"
}
}
},
"expected": {
"status": "unknown-token",
"context": "warehouse"
}
}
];
for (const c of cases) assert.deepEqual(evaluate(c.input), c.expected, c.id);
console.log(JSON.stringify({checked:cases.length,caseIds:cases.map(c=>c.id)}));
Record context selection with each evaluated answer. This fixture tests retrieval-conditioned glossary choice and deliberately supplies canonical labels; it does not infer industry meanings from a bare abbreviation.